【问题标题】:npm install unhandled rejectionnpm install 未处理的拒绝
【发布时间】:2019-02-22 19:46:15
【问题描述】:

我试图弄清楚为什么 npm install 不再适用于 Ubuntu 14 LTS 机器。

该项目是nuxt 项目,npm install 在 Unix 机器上工作。

我已尝试卸载并重新安装 node 和 npm。

当前版本是:

  • 节点:v10.15.1
  • npm : 6.4.1

如果我运行npm install --verbose

我们得到

Unhandled rejection Error: Command failed: /usr/bin/git clone --depth=1 -q -b master git://github.com/dcodeIO/long.js.git /home/<USER>/.npm/_cacache/tmp/git-clone-226d28b2
/home/<USER>/.npm/_cacache/tmp/git-clone-226d28b2/.git: Permission denied

    at ChildProcess.exithandler (child_process.js:294:12)
    at ChildProcess.emit (events.js:189:13)
    at maybeClose (internal/child_process.js:970:16)
    at Socket.stream.socket.on (internal/child_process.js:389:11)
    at Socket.emit (events.js:189:13)
    at Pipe._handle.close (net.js:600:12)

npm timing npm Completed in 128572ms
npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/<USER>/.npm/_logs/2019-02-21T15_22_07_078Z-debug.log

该文件的最后几行是:

17822 silly extract core-js@2.6.5 extracted to /home/<USER>/<PROJECT>/node_modules/.staging/core-js-49a396dc (950ms)
17823 silly extract vuetify@1.5.1 extracted to /home/<USER>/<PROJECT>/node_modules/.staging/vuetify-c586b9e6 (4197ms)
17824 timing npm Completed in 128572ms
17825 error cb() never called!
17826 error This is an error with npm itself. Please report this error at:
17827 error <https://npm.community>

【问题讨论】:

  • 你尝试清除 npm 缓存了吗?
  • @MebinJoe 是的,即使这个 npm@5+ 警告缓存是自我修复的
  • 您是否尝试以递归方式将/Users/../.npm/ 的权限重置给您的用户。详情:* docs.npmjs.com/getting-started/fixing-npm-permissions * docs.npmjs.com/troubleshooting/try-clearing-the-npm-cache
  • @MebinJoe 之前出现在其中一些页面上。卸载并重新安装。现在我有权限错误。使用sudo 运行会导致同样的问题。请救救我:(
  • 我就是这么说的。可能是您的 Ubuntu 14 LTS 机器中的用户的权限问题。

标签: node.js git npm


【解决方案1】:

尝试通过 nvm(节点版本管理器)安装节点。

卷曲 -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh |重击

只需尝试这些简单的步骤(希望它适用于您的情况):

  • 完成此操作后,将此命令复制并粘贴到终端中。
  • 关闭并重新打开终端
  • 键入 nvm 以检查您的系统上是否安装了 nvm。
  • 通过检查 nvm ls 输入(这会显示默认节点安装版本)。
  • 然后转到您的项目目录并使用 npm installnpm i

【讨论】:

    猜你喜欢
    • 2018-11-11
    • 2019-09-24
    • 1970-01-01
    • 2019-08-10
    • 2017-09-23
    • 2019-03-15
    • 2016-07-21
    • 2021-12-30
    • 1970-01-01
    相关资源
    最近更新 更多