npm install -g vue-cli 安装失败的解决方法

npm install -g vue-cli 安装失败的解决方法

错误信息如下

Microsoft Windows [版本 10.0.17134.706]
(c) 2018 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>node -v
v10.15.3

C:\Users\Administrator>npm install -g vue-cli
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN tarball tarball data for [email protected] (sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=) seems to be corrupted. Trying one more time.
npm ERR! path C:\Users\Administrator\AppData\Roaming\npm\node_modules\.staging\json-schema-c12ec15a\draft-zyp-json-schema-04.xml
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall unlink
npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\.staging\json-schema-c12ec15a\draft-zyp-json-schema-04.xml'
npm ERR!  { [Error: EPERM: operation not permitted, unlink 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\.staging\json-schema-c12ec15a\draft-zyp-json-schema-04.xml']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, unlink 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\.staging\json-schema-c12ec15a\draft-zyp-json-schema-04.xml'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'unlink',
npm ERR!      path:
npm ERR!       'C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\.staging\\json-schema-c12ec15a\\draft-zyp-json-schema-04.xml' },
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, unlink \'C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\.staging\\json-schema-c12ec15a\\draft-zyp-json-schema-04.xml\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'unlink',
npm ERR!   path:
npm ERR!    'C:\\Users\\Administrator\\AppData\\Roaming\\npm\\node_modules\\.staging\\json-schema-c12ec15a\\draft-zyp-json-schema-04.xml',
npm ERR!   parent: 'vue-cli' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-05-18T14_09_28_926Z-debug.log

C:\Users\Administrator>

解决方法

npm cache clean --force

你可能感兴趣的:(技术随笔)