node.js - npm install gatsby-plugin-styled-components 出错
问题描述
我正在尝试安装这些 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
解决方案
- 删除 node_modules
npm cache clean
- 尝试重新安装
应该有帮助。
推荐阅读
- sql - SQL在给定开始日期和年数的情况下获取每一年的开始日期和结束日期
- html - 容器内的行高表现不同
- docker - 从 docker stack 模式访问本地网络主机
- python - 无法获得 gunicorn 访问日志响应时间的毫秒级读数
- python - Groupby 日期,但填充来自不同行的空值并对数字求和
- logging - Rule Execution Server 中的规则集级别日志记录
- docker - 将主机添加到 docker windows 容器中的 etc/hosts
- javascript - 尝试将道具分配给状态变量的反应不起作用
- python - 在for循环中比较python中JSON对象的值
- c# - 生成还原了 NuGet 包。再次构建项目以在构建中包含这些包