简体   繁体   中英

NPM Global Install Fails

The global install of this CLI started failing and I'm not sure why.

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:

    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 ).

Also tried:

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

And then npm i -g and the result is still the same.

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

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. 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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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