【问题标题】:Error when running "npm install -g @vue/cli", reinstall attempted many times运行“npm install -g @vue/cli”时出错,多次尝试重新安装
【发布时间】:2021-07-25 09:52:12
【问题描述】:

我已经坚持了很长时间。当我运行 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

我已经坚持了好几个小时了,感谢您的帮助

谢谢!

【问题讨论】:

    标签: node.js vue.js npm-install vue-cli


    【解决方案1】:

    WARN 不是问题。

    它确实无法运行节点二进制文件。 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 变量。

    【讨论】:

      【解决方案2】:

      请遵循其中任何一个来避免这些

      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

      【讨论】:

        猜你喜欢
        • 2021-02-13
        • 2021-08-25
        • 2020-12-19
        • 1970-01-01
        • 2021-02-13
        • 1970-01-01
        • 2020-11-01
        • 1970-01-01
        • 2019-12-17
        相关资源
        最近更新 更多