【问题标题】:How to fix this Error -npm如何修复此错误 -npm
【发布时间】:2018-08-14 14:15:52
【问题描述】:

我尝试安装 npm 并得到以下error。 我已经删除了 npm 并再次重新安装,但我再次收到以下错误:


npm ERR! Linux 4.15.0-30-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! code ELIFECYCLE
npm ERR! vx-leave-system@0.0.1 start: `node ./tools/server.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vx-leave-system@0.0.1 start script 'node ./tools/server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vx-leave-system package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./tools/server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs vx-leave-system
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls vx-leave-system
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR!     /home/seelan/Documents/vx-leave-system/npm-debug.log

我该如何解决这个问题?

【问题讨论】:

  • 问题可能是 nodejs 版本不适合。您可以在“npm-debug.log”中发布您拥有的内容以及您拥有的 package.json

标签: node.js npm npm-install


【解决方案1】:

在 ubuntu 18.04 上,以下步骤救了我

要删除发行稳定版,请输入以下内容:

sudo apt remove nodejs

此命令将删除包并保留配置文件。

sudo apt purge nodejs

作为最后一步,您可以删除任何随已删除软件包自动安装的未使用软件包:

sudo apt autoremove

通过键入以下内容刷新您的本地包索引:

sudo apt update

通过运行以下命令启用 NodeSource 存储库

(可选)如果您需要安装其他版本,例如 14.x,只需将 setup_12.x 更改为 setup_14.x

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -

启用 NodeSource 存储库后,键入以下命令安装 Node.js 和 npm:

sudo apt install nodejs

通过打印它们的版本来验证 Node.js 和 npm 是否已成功安装:

node --version (v12.18.4)
npm --version (6.14.6)

【讨论】:

    【解决方案2】:

    在我看来,您运行的是更新版本的 Node,但运行的是过时版本的 NPM。

    您可以执行以下任一操作:

    1. 试用最新稳定版NPM:
      您可以使用以下方式升级到最新版本的 npm:npm install -g npm@latest

    1. 从您的机器上完全卸载Node,转到他们的website 并安装最新的稳定Node 版本。 NPM 自带。

    【讨论】:

      【解决方案3】:

      我今天也遇到了这个问题,这个问题是由我的节点和 npm 版本升级引起的。猜猜我的项目依赖项仍在旧版本的 node 和 npm 上运行

      我通过删除 node_modules 文件夹并运行来修复它

      npm install
      

      希望对你有帮助

      【讨论】:

        【解决方案4】:

        这看起来像是您的主目录中的权限问题。要收回 .npm 目录的所有权,请执行:

        sudo chown -R $(whoami) ~/.npm
        

        【讨论】:

          【解决方案5】:

          检查依赖的更新

          npm outdate
          

          运行下一条命令更新依赖项

          npm update
          

          【讨论】:

            【解决方案6】:

            去掉路径文件夹目录C:\Users\ACER\AppData\Local**\npm-cache_logs\2021-12-29T13_41_22_984Z-debug-0.log**

            然后在 CLI 中运行此命令 npm install -g npm@latest

            这对你有用

            【讨论】:

              猜你喜欢
              • 2022-01-16
              • 1970-01-01
              • 1970-01-01
              • 2017-10-20
              • 2020-02-22
              • 2014-03-01
              • 2012-07-09
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多