NPM全局安装失败

时间:2019-02-06 21:58:32

标签: javascript node.js ubuntu npm

此CLI的全局安装开始失败,我不确定为什么。

git clone https://github.com/superflycss/cli
cd cli
npm i -g

该日志文件为1万行日志,但这就是最后的内容:

    7353 verbose stack Error: ENOENT: no such file or directory, rename '/home/ole/.nvm/versions/node/v11.0.0/lib/node_modules/.staging/@superflycss/cli-5549c074/node_modules/@babel/code-frame' -> '/home/ole/.nvm/versions/node/v11.0.0/lib/node_modules/.staging/@babel/code-frame-78217d7a'
    7354 verbose cwd /home/ole/SuperflyCSS/cli
    7355 verbose Linux 4.15.0-45-generic
    7356 verbose argv "/home/ole/.nvm/versions/node/v11.0.0/bin/node" "/home/ole/.nvm/versions/node/v11.0.0/bin/npm" "i" "-g"
    7357 verbose node v11.0.0
    7358 verbose npm  v6.7.0
    7359 error path /home/ole/.nvm/versions/node/v11.0.0/lib/node_modules/.staging/@superflycss/cli-5549c074/node_modules/@babel/code-frame
    7360 error code ENOENT
    7361 error errno -2
    7362 error syscall rename
    7363 error enoent ENOENT: no such file or directory, rename '/home/ole/.nvm/versions/node/v11.0.0/lib/node_modules/.staging/@superflycss/cli-5549c074/node_modules/@babel/code-frame' -> '/home/ole/.nvm/versions/node/v11.0.0/lib/node_modules/.staging/@babel/code-frame-78217d7a'
    7364 error enoent This is related to npm not being able to find a file.
    7365 verbose exit [ -2, true ]

I've tried removing all global modules per the instructions here,然后重新安装。但是,即使刷新了完整的本地模块(Nuke本地node_modules),它仍然失败。

也尝试过:

sudo rm -fr /home/ole/.npm-packages / *

然后是npm i -g,结果仍然相同。

更新

我认为可能是这个错误:

https://npm.community/t/global-installs-sudo-npm-i-g-fail-on-mac-after-6-5-upgrade-works-fine-after-6-4-1-downgrade/4082/15

3 个答案:

答案 0 :(得分:0)

也许您可以尝试通过npmjs注册表通过npm在全球范围内安装superflycss CLI,而不是克隆superflycss存储库并尝试从源代码进行构建。例如:

npm i -g @superflycss/cli

然后像这样使用它:

  Usage: sfc [options] [command]

希望有帮助!

答案 1 :(得分:0)

docker run -it node bash
git clone https://github.com/superflycss/cli
cd cli
npm i -g

工作正常!

root@c3adb3ae08aa:/cli# sfc --version
1.0.0
root@c3adb3ae08aa:/cli# sfc --help
Usage: sfc [options] [command]

SuperflyCSS Command Line Interface
[more stuff here]

尝试清除您的node_modules全局缓存和本地目录。

答案 2 :(得分:0)

通过升级到节点v11.9.0和NPM v6.7.0来解决此问题。