Vue-cli 3: "command failed: npm install --loglevel error"

Viewed 20866

Every time I try to create a new project (vue create my-project), I get this error:

ERROR : command failed: npm install --loglevel error

I'm on PC / Windows 10, Vue-cli 3.2.1, Node 8.11.3, Npm 5.6.0. Presets: Babel, ESLint & Prettier, SASS, Vue router, Vuex

From the log:

2736 silly saveTree `-- vuex@3.0.1

2737 warn ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.

2738 verbose stack Error: EINVAL: invalid argument, read

Any idea what that means and how to solve it?

EDIT: I figured out that excluding any lint feature makes the problem disappear. So the question becomes: how can I still use linting and make it work?

enter image description here

15 Answers

Try

npm cache clean --force 

If it doesn't work then manually delete %appdata%\npm-cache folder. Then try to create the project again.

Try pointing the npm registry url from 'https' to 'http'

Run following command :

npm config set registry="http://registry.npmjs.org/"

Then try creating vue project :

vue create my-project

It worked for me.

OR Try :

  1. sudo npm cache clean -f
  2. npm update
  3. npm update -g @vue/cli
  4. vue create vue-first-app

I've tried everything above but still the error kept occuring. Finally I upgraded my npm version and node version, both to the latest ones and it worked.

Try using 'Dart-Sass' instead of using 'Node-Sass'. This will create your Vue project without any errors.

I am using "vue-cli 3.0.0-rc.1", I solve the problems by setting the ~/.vuerc from "useTaobaoRegistry": true, to false. Hope it help to you!!

The reason behind the error is , u are having an outdated version of node js. Try to reinstall node js and the probelm will get fixed("dont forget to uninstall and clear all the node js file before re-installing ")

I am using vue-cli 3.7.0-rc.1, I solve the problems by editing the ~/.vuerc from "useTaobaoRegistry": false to true.

Hope it works for you!

change permission by using the cli

npm config set unsafe-perm true

The problem is on the CLI

  1. npm cache clean --force
  2. %appdata%\npm-cache Just run on the "Run" Then Delete all the files
  3. npm install -g @vue/cli
  4. Just use npm 6 or greater
  5. vue create projectName

problem solved 100% work for me cheers

If you run into this issue on a Mac or Linux machine, you may simply need to sudo.

sudo vue create my-project

If you run into it on Windows, you may resolve the issue by running the terminal as admin.

I had the same issue. You have to use the command vue config --set useTaobaoRegistry false. After that it worked for me.

I had same issue when i was installing vue-cli with npx .... tried all the solutions from google.. nothing worked for me ..

so then i moved to install vue-cli with yarn package manager thats when i figured out the issue .. my issue was basically my node version which was 8.x.x but yarn was expecting 10.x.x with nvm i have installed latest node which is 16.x.x then tried installing vue-cli with yarn ..

it worked like charm!!!!

I had the same issue using Ubuntu 20.04 OS. I used the command

npm install --loglevel error --legacy-peer-deps

and it worked for me.

Likely issue is your proxy settings:

I was having this issue recur intermittently and in the end I found out it was being caused by network proxy issues. See this article on how run npm behind a proxy server

Related