运行"npm install -g @vue/cli"时出错,多次尝试重新安装



我在这个问题上已经坚持了很长时间。当我运行npm install-g@vue/cli时,它会弹出以下错误。simliar错误也发生在我运行vue-create项目名称时。我试过多次重新安装,也试过清理缓存。我很清楚字典中的错误";C: \Users\zhang\node_modules.bin/../node/bin/node"不存在,但我不知道如何修复它。

C:Userszhang>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:UserszhangAppDataRoamingnpmnode_modules@vueclinode_modulescore-js-pure
npm ERR! command failed
npm ERR! command D:Program Filesgitbinbash.exe -c node -e "try{require('./postinstall')}catch(e){}"
npm ERR! /c/Users/zhang/node_modules/.bin/node: line 8: C:Userszhangnode_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:UserszhangAppDataLocalnpm-cache_logs2021-05-02T21_16_30_121Z-debug.log

我已经被困在这个问题上好几个小时了,我感谢你的任何帮助

谢谢!

WARN不是问题。

它确实无法运行节点二进制文件。npm ERR! /c/Users/zhang/node_modules/.bin/node: line 8: C:Userszhangnode_modules.bin/../node/bin/node: No such file or directory

确保你走对了路。或者相应地更改env PATH变量。

请遵循其中任何一项以避免这些

1.正确设置环境路径

2.确保当前用户有权处理数据

ls-la/usr/lib/nod_modulewhoamisudo chown-R$USER/usr/lib/nod_module(将权限设置为当前用户(

3.通过将npm安装为sudo用户

sudo npm i-g@vue/cli

最新更新