微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

无法安装 Netlify-Cli

如何解决无法安装 Netlify-Cli

我正在尝试使用 Linux 终端安装 Netlify-Cli。
我试过这个命令:

npm install netlify-cli -g

但它抛出了一些错误

> yarn@1.22.10 preinstall /usr/local/lib/node_modules/netlify-cli/node_modules/yarn
> :; (node ./preinstall.js > /dev/null 2>&1 || true)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/netlify-cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-win32-x64@0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent-win32-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/traffic-mesh-agent-win32-x64@0.27.10: wanted {"os":"win32","arch":"x64"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @netlify/traffic-mesh-agent-darwin-x64@0.27.10 (node_modules/netlify-cli/node_modules/@netlify/traffic-mesh-agent-darwin-x64):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @netlify/traffic-mesh-agent-darwin-x64@0.27.10: wanted {"os":"darwin","arch":"x64"})

npm ERR! code EACCES
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/netlify-cli/bin/run
npm ERR! dest /usr/local/bin/netlify
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied,symlink '../lib/node_modules/netlify-cli/bin/run' -> '/usr/local/bin/netlify'
npm ERR!  { [Error: EACCES: permission denied,symlink '../lib/node_modules/netlify-cli/bin/run' -> '/usr/local/bin/netlify']
npm ERR!   cause:
npm ERR!    { Error: EACCES: permission denied,symlink '../lib/node_modules/netlify-cli/bin/run' -> '/usr/local/bin/netlify'
npm ERR!      errno: -13,npm ERR!      code: 'EACCES',npm ERR!      syscall: 'symlink',npm ERR!      path: '../lib/node_modules/netlify-cli/bin/run',npm ERR!      dest: '/usr/local/bin/netlify' },npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied,symlink \'../lib/node_modules/netlify-cli/bin/run\' -> \'/usr/local/bin/netlify\'',npm ERR!   errno: -13,npm ERR!   code: 'EACCES',npm ERR!   syscall: 'symlink',npm ERR!   path: '../lib/node_modules/netlify-cli/bin/run',npm ERR!   dest: '/usr/local/bin/netlify' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
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.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/silence/.npm/_logs/2021-05-09T13_28_21_198Z-debug.log

如果有任何小帮助会有所帮助。

解决方法

看到这个:https://answers.netlify.com/t/errors-with-netlify-cli/26842

您的用户没有足够的权限。

,

感谢boirslav popov
正如他在回答中提到的那样,它对其中一些人有效,即

sudo npm install netlify-cli -g

但遗憾的是它对我不起作用:(

对于那些,如果上面的命令不起作用可以按照附加的答案:D Answer

我关注了这个answer


sudo npm install -g --unsafe-perm=true netlify-cli

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。