如何解决运行“npm install -g @vue/cli”时出错,多次尝试重新安装
我已经坚持了很长时间。当我运行 npm install -g @vue/cli 时,它会弹出以下错误。当我运行 vue create project-name 时也会发生类似的错误。我试过多次重新安装,也试过清理缓存。我很清楚错误“C:\Users\zhang\node_modules.bin/../node/bin/node”中的字典不存在,但我不知道如何修复它。
C:\Users\zhang>npm install -g @vue/cli
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated request@2.88.2: request has been deprecated,see https://github.com/request/request/issues/3142
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
npm ERR! code 127
npm ERR! path C:\Users\zhang\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\core-js-pure
npm ERR! command failed
npm ERR! command D:\Program Files\git\bin\bash.exe -c node -e "try{require('./postinstall')}catch(e){}"
npm ERR! /c/Users/zhang/node_modules/.bin/node: line 8: C:\Users\zhang\node_modules\.bin/../node/bin/node: No such file or directory
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\zhang\AppData\Local\npm-cache\_logs\2021-05-02T21_16_30_121Z-debug.log
我已经坚持了几个小时,感谢您的任何帮助
谢谢!
解决方法
警告不是问题。
它确实无法运行节点二进制文件。
npm ERR! /c/Users/zhang/node_modules/.bin/node: line 8: C:\Users\zhang\node_modules\.bin/../node/bin/node: No such file or directory
确保您获得正确的路径。或者相应地更改 env PATH 变量。
,请遵循以下任何一条以避免这些
1.正确设置环境路径
2.确保当前用户具有处理数据的权限
ls -la /usr/lib/node_modules 我是谁 sudo chown -R $USER /usr/lib/node_modules(设置当前用户权限)
3.以sudo用户身份安装npm
sudo npm i -g @vue/cli
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。