Cannot install @vue/cli, permission error in require('./postinstall')

I can’t install @vue/cli. I’ve used vue-cli before. I uninstalled vue-cli and deleted /root/.nvm/versions/node/v10.16.3/bin/vue . When I do npm install -g @vue/cli I get the error below. I’m on windows 10 in wsl. Node is version v10.16.3. I’ve tried npm cache clear --force.

npm install @vue/cli -g
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage 
due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.   
npm WARN deprecated fsevents@1.2.9: One of your dependencies needs to upgrade to fsevents v2: 1) Proper nodejs v10+ support 2) No more fetching binaries from AWS, smaller package size
/root/.nvm/versions/node/v10.16.3/bin/vue -> /root/.nvm/versions/node/v10.16.3/lib/node_modules/@vue/cli/bin/vue.js

> core-js@2.6.11 postinstall /root/.nvm/versions/node/v10.16.3/lib/node_modules/@vue/cli/node_modules/babel-polyfill/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

sh: 1: node: Permission denied
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules/@vue/cli/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! core-js@2.6.11 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the core-js@2.6.11 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.   

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-12-11T23_18_48_617Z-debug.log

The permission error gives me no clue where in the file system the error occured.

1 Like

Because of the two deprecation warnings I tried to install core-js and fsevents. I got the same error as I did installing @vue/cli. Does this mean something?

npm i -g core-js

> core-js@3.4.8 postinstall /root/.nvm/versions/node/v10.16.3/lib/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

sh: 1: node: Permission denied
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! core-js@3.4.8 postinstall: `node -e "try{require('./postinstall')}catch(e){}"`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the core-js@3.4.8 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.   

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-12-11T23_53_01_644Z-debug.log

wsl(~/.nvm/versions/node/v10.16.3/lib/node_modules) npm i -g fsevents
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! notsup Valid OS:    darwin
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   linux
npm ERR! notsup Actual Arch: x64

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-12-11T23_53_41_247Z-debug.log
1 Like

Can anyone suggest what I should try next? I could wipe windows and install from scratch but that would be a day’s work.

1 Like
  1. Deprecation warnings are just warnings, I do not think it is the course of the error (may be wrong, of course)
  2. Have a look at the log mentioned in the error message (/root/.npm/_logs/2019-12-11T23_53_01_644Z-debug.log)
  3. There is probably some problem with permission rights, as the error message tells. Maybe you could bypass it by using:
    sudo npm install -g --unsafe-perm @vue/cli
    but better solution is to find real course (bad user? bad rights to the foldder?). Above mention log could help.
1 Like

thanks, --unsafe-perm fixed it. I didn’t even know I was running as root. wsl must have made me root.

3 Likes

May I ask you please explain how did you fix the errors?

I was running as user root so I needed to add the --unsafe-perm to the command above, as suggested.

already solved at here https://icetutor.com/question/npm-warn-deprecated-core-js2-6-11-core-js3-is-no-longer-maintained-and-not-recommended-for-usage-due-to-the-number-of-issues/