简体   繁体   English

NPM全局安装失败

[英]NPM Global Install Fails

The global install of this CLI started failing and I'm not sure why. 此CLI的全局安装开始失败,我不确定为什么。

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

The log file is 10K lines log, but this is what it says at the end: 日志文件是10K行日志,但这是最后的内容:

    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 and then reinstalling. 我尝试按照此处的说明删除所有全局模块 ,然后重新安装。 However it still fails, even with a complete local module refresh (Nuke local node_modules ). 但是,即使完全刷新了本地模块(Nuke local node_modules ),它仍然会失败。

Also tried: 还尝试了:

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

And then npm i -g and the result is still the same. 然后npm i -g ,结果仍然相同。

Update 更新资料

I think it might be this bug: 我认为可能是这个错误:

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

Maybe you could try installing the superflycss CLI globally with npm through the npmjs registry as opposed to cloning the superflycss repository and trying to build from source. 也许您可以尝试通过npmjs注册表通过npm在全球范围内安装superflycss CLI,而不是克隆superflycss存储库并尝试从源代码进行构建。 For example: 例如:

npm i -g @superflycss/cli

then just use it like so: 然后像这样使用它:

  Usage: sfc [options] [command]

Hopefully that helps! 希望有帮助!

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

Works just fine! 效果很好!

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

SuperflyCSS Command Line Interface
[more stuff here]

Try clearing your node_modules global cache and local dir. 尝试清除您的node_modules全局缓存和本地目录。

通过升级到节点v11.9.0和NPM v6.7.0修复了此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM