npm安装gatsby-plugin-styled-components时出错

时间:2018-10-21 18:49:16

标签: node.js npm

我正在尝试安装这些npm软件包

npm install --save gatsby-plugin-styled-components styled-components babel-plugin-styled-components

我正在使用节点版本10.11.0

但是我收到以下错误,我尝试在管理员模式下的Power-shell中运行它没有任何作用

npm ERR! path C:\Users\Anders\sites\pro-gatsby\node_modules\@types\events\npm-shrinkwrap.json
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall open
npm ERR! Error: EPERM: operation not permitted, open 'C:\Users\Anders\sites\pro-gatsby\node_modules\@types\events\npm-shrinkwrap.json'
npm ERR!  { [Error: EPERM: operation not permitted, open 'C:\Users\Anders\sites\pro-gatsby\node_modules\@types\events\npm-shrinkwrap.json']
npm ERR!   cause:
npm ERR!    { Error: EPERM: operation not permitted, open 'C:\Users\Anders\sites\pro-gatsby\node_modules\@types\events\npm-shrinkwrap.json'
npm ERR!      errno: -4048,
npm ERR!      code: 'EPERM',
npm ERR!      syscall: 'open',
npm ERR!      path:
npm ERR!       'C:\\Users\\Anders\\sites\\pro-gatsby\\node_modules\\@types\\events\\npm-shrinkwrap.json' },
npm ERR!   isOperational: true,
npm ERR!   stack:
npm ERR!    'Error: EPERM: operation not permitted, open \'C:\\Users\\Anders\\sites\\pro-gatsby\\node_modules\\@types\\events\\npm-shrinkwrap.json\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path:
npm ERR!    'C:\\Users\\Anders\\sites\\pro-gatsby\\node_modules\\@types\\events\\npm-shrinkwrap.json',
npm ERR!   parent: '@types/glob' }
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\Anders\AppData\Roaming\npm-cache\_logs\2018-10-20T22_44_07_361Z-debug.log

1 个答案:

答案 0 :(得分:2)

  1. 删除node_modules
  2. npm cache clean
  3. 尝试重新安装

应该帮助。