如果我创建一个新的 npm 项目:
mkdir ~/test
cd ~/test
npm init -y
Run Code Online (Sandbox Code Playgroud)
然后尝试安装Sharp:
npm install --save sharp
Run Code Online (Sandbox Code Playgroud)
我收到以下错误消息:
> sharp@0.18.4 install /Users/hsribei/tmp/test/node_modules/sharp
> node-gyp rebuild
sh: /usr/local/lib/node_modules/npm/bin/node-gyp-bin/node-gyp: Permission denied
npm WARN test@1.0.0 No description
npm WARN test@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! sharp@0.18.4 install: `node-gyp rebuild`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the sharp@0.18.4 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/hsribei/.npm/_logs/2017-09-20T19_11_03_836Z-debug.log
Run Code Online (Sandbox Code Playgroud)
我找到了删除的说明~/.node-gyp,尝试了,没有用。删除node_modules再试也无效。运行 assudo也没有帮助。
我有什么想法可以追踪问题所在吗?
我发现缺少全局依赖项sharp。
如果你跑
npm install -g node-gyp
Run Code Online (Sandbox Code Playgroud)
首先,然后
npm install --save sharp
Run Code Online (Sandbox Code Playgroud)
有用。
| 归档时间: |
|
| 查看次数: |
4311 次 |
| 最近记录: |