Vue-cli 3: “command failed: npm install --loglevel error”

风流意气都作罢 提交于 2020-12-29 09:02:21

问题


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?


回答1:


Try

npm cache clean --force 

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




回答2:


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.




回答3:


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




回答4:


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!




回答5:


change permission by using the cli

npm config set unsafe-perm true



回答6:


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




回答7:


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



来源:https://stackoverflow.com/questions/53934852/vue-cli-3-command-failed-npm-install-loglevel-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!