Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

“ERROR command failed: npm install --loglevel error” when trying to do “vue create” #3102

Closed
MichaelCharles opened this issue Dec 9, 2018 · 25 comments

Comments

@MichaelCharles
Copy link

MichaelCharles commented Dec 9, 2018

Version

3.2.1

Environment info

  System:
    OS: Linux 4.18 Ubuntu 18.10 (Cosmic Cuttlefish)
    CPU: (1) x64 Intel(R) Xeon(R) CPU @ 2.30GHz
  Binaries:
    Node: 10.14.1 - /usr/bin/node
    Yarn: Not Found
    npm: 6.4.1 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: Not Found
  npmPackages:
    @vue/babel-preset-app:  3.2.0 
    @vue/cli-overlay:  3.2.0 
    @vue/cli-plugin-babel: ^3.2.0 => 3.2.0 
    @vue/cli-plugin-eslint: ^3.2.0 => 3.2.1 
    @vue/cli-service: ^3.2.0 => 3.2.0 
    @vue/cli-shared-utils:  3.2.0 
    @vue/component-compiler-utils:  2.3.0 
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/web-component-wrapper:  1.2.0 
    babel-helper-vue-jsx-merge-props:  2.0.3 
    babel-plugin-transform-vue-jsx:  4.0.1 
    eslint-plugin-vue:  4.7.1 
    vue-eslint-parser:  2.0.3 
    vue-hot-reload-api:  2.3.1 
    vue-loader:  15.4.2 
    vue-style-loader:  4.1.2 
    vue-template-es2015-compiler:  1.6.0 
  npmGlobalPackages:
    @vue/cli: 3.2.1

Steps to reproduce

vue create portfolio

What is expected?

Start a new Vue project.

What is actually happening?

Vue CLI v3.2.1
✨  Creating project in /home/mcaubrey511/portfolio.
🗃  Initializing git repository...
⚙  Installing CLI plugins. This might take a while...


> yorkie@2.0.0 install /home/mcaubrey511/portfolio/node_modules/yorkie
> node bin/install.js


ERROR  command failed: npm install --loglevel error
@MichaelCharles
Copy link
Author

MichaelCharles commented Dec 9, 2018

After switching the machine I was using to Ubuntu 18.04 LTS I am no longer having the problem, so perhaps it's an issue specific to Ubuntu 18.10?

@grgurev
Copy link

grgurev commented Dec 9, 2018

I'm having the same problem with same error message too when trying to create new or run npm install in existing project. I'm using Node 11 within docker and until now never had any problems creating projects with vue-cli.

@tripflex
Copy link

Having this same issue as well, already tried everything from #889

node: v8.11.2
npm: 6.5.0
osx: 10.13.6

@prashant1k99
Copy link

Well this was the problem I also faced. But I found that you can install it using yarn.
yarn global add @vue/cli
and then create project using the code
vue create YourProjectName
Then after that cd into the project and run yarn server by yarn serve.

@eberkund
Copy link

eberkund commented Jan 4, 2019

I am having this problem when compiling inside a snapcraft environment

@sodatea
Copy link
Member

sodatea commented Feb 19, 2019

#3466 (comment)
Did you run these commands as root or with sudo?

@alexpilugin
Copy link

The same issue!

@rabbygit
Copy link

Check issue #889.

@mc6415
Copy link

mc6415 commented Jun 17, 2019

I'm coming up against this issue specifically when using Yarn, NPM is working fine but Yarn keeps throwing this damn error, googling I haven't found anything out either, tearing my hair out trying to get this to work, never used to have problems!

@doria76593
Copy link

我也遇到这个问题,我的解决方式是,以管理员身份运行,就可以了

@sodatea
Copy link
Member

sodatea commented Oct 14, 2019

Closing this because the original issue is no longer reproducible, and the later ones are likely to be caused by permission issues https://cli.vuejs.org/guide/troubleshooting.html#running-installation-with-sudo-or-as-root

@sodatea sodatea closed this as completed Oct 14, 2019
@volantes
Copy link

volantes commented Apr 1, 2020

What worked for me:

Not trying to vue create projectname in a Google Drive "G:" drive directory.

Solution: runing vue create projectname in a C:\ drive directory.

I'm running Windows 10.

I hope this helps someone.

@ryusuke1998
Copy link

thanks.
it worked!

@nikhilbhavsar5895
Copy link

nikhilbhavsar5895 commented Jul 20, 2020

#3466 (comment)
Did you run these commands as root or with sudo?

yes what is solution for this

@nikhilbhavsar5895
Copy link

Closing this because the original issue is no longer reproducible, and the later ones are likely to be caused by permission issues https://cli.vuejs.org/guide/troubleshooting.html#running-installation-with-sudo-or-as-root

this is not working for me. Can you suggest any another way please

@cruzxxx
Copy link

cruzxxx commented Aug 25, 2020

I was having the same issue using Ubuntu 18.04, and could solve by uninstalling vue using NPM and then installing it again using YARN.

Commands to uninstall vue:

sudo npm uninstall -g vue
sudo npm uninstall -g vue-cli
sudo npm uninstall -g @vue/cli

Install yarn: https://classic.yarnpkg.com/en/docs/install/#debian-stable

Then proceed to create app vue create my-app and install the preset also using yarn.

@Cristiane-Pereira
Copy link

Eu estava obtendo esse erro no terminal com o gerenciador de pacote npm,eu desinstalei o @vue/cli global que eu havia instalado na maquina com o comando npm uninstall -g @vue/cli,em seguida eu limpei o cache do npm com o comando npm cache clean --force e em seguida reinstalei novamente o vue-cli com o comando npm i -g @vue/cli,com ele instalado criei um novo projeto com o comando vue create nome do projeto e parou de aparecer esse erro.

@eternalcoder12
Copy link

我在macos 上碰到该问题,安装yarn之后,问题便不再出现

@Indomite
Copy link

Indomite commented Jun 2, 2021

There may be a problem with the version of node. This problem occurred when I was using version 16.0. It was like ERROR command failed: npm install --loglevel error --legacy-peer-deps
But the problem was solved when switching to version 12.18

@joshuaoyerinde
Copy link

am having this issue when creating a vue project .... and am using good internet
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npm.taobao.org/emoji-regex/download/emoji-regex-8.0.0.tgz?cache=0&sync_timestamp=1614682798745&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Femoji-regex%2Fdownload%2Femoji-regex-8.0.0.tgz failed, reason: getaddrinfo ENOTFOUND registry.npm.taobao.org
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm install --loglevel error

@lavanyascyberlife
Copy link

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

@abhijnanacharya
Copy link

npm ERR! code 1
npm ERR! path /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /usr/bin/node /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli '/usr/bin/node',
npm ERR! gyp verb cli '/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-gyp/bin/node-gyp.js',
npm ERR! gyp verb cli 'rebuild',
npm ERR! gyp verb cli '--verbose',
npm ERR! gyp verb cli '--libsass_ext=',
npm ERR! gyp verb cli '--libsass_cflags=',
npm ERR! gyp verb cli '--libsass_ldflags=',
npm ERR! gyp verb cli '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@17.6.0 | linux | x64
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb which failed Error: not found: python2
npm ERR! gyp verb which failed at getNotFoundError (/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:13:12)
npm ERR! gyp verb which failed at F (/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:68:19)
npm ERR! gyp verb which failed at E (/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:80:29)
npm ERR! gyp verb which failed at /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:89:16
npm ERR! gyp verb which failed at /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/isexe/index.js:42:5
npm ERR! gyp verb which failed at /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb which failed at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp verb which failed python2 Error: not found: python2
npm ERR! gyp verb which failed at getNotFoundError (/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:13:12)
npm ERR! gyp verb which failed at F (/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:68:19)
npm ERR! gyp verb which failed at E (/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:80:29)
npm ERR! gyp verb which failed at /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:89:16
npm ERR! gyp verb which failed at /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/isexe/index.js:42:5
npm ERR! gyp verb which failed at /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/isexe/mode.js:8:5
npm ERR! gyp verb which failed at FSReqCallback.oncomplete (node:fs:198:21) {
npm ERR! gyp verb which failed code: 'ENOENT'
npm ERR! gyp verb which failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb which succeeded python /usr/bin/python
npm ERR! gyp verb check python version /usr/bin/python -c "import sys; print "2.7.18 npm ERR! gyp verb check python version .%s.%s" % sys.version_info[:3];" returned: %j
npm ERR! gyp verb get node dir no --target version specified, falling back to host node version: 17.6.0
npm ERR! gyp verb command install [ '17.6.0' ]
npm ERR! gyp verb install input version string "17.6.0"
npm ERR! gyp verb install installing version: 17.6.0
npm ERR! gyp verb install --ensure was passed, so won't reinstall if already installed
npm ERR! gyp verb install version is already installed, need to check "installVersion"
npm ERR! gyp verb got "installVersion" 9
npm ERR! gyp verb needs "installVersion" 9
npm ERR! gyp verb install version is good
npm ERR! gyp verb get node dir target node version installed: 17.6.0
npm ERR! gyp verb build dir attempting to create "build" dir: /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-sass/build
npm ERR! gyp verb build dir "build" dir needed to be created? /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-sass/build
npm ERR! gyp verb build/config.gypi creating config file
npm ERR! gyp verb build/config.gypi writing out config file: /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-sass/build/config.gypi
npm ERR! (node:7319) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use node --trace-deprecation ... to show where the warning was created)
npm ERR! gyp verb config.gypi checking for gypi file: /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-sass/config.gypi
npm ERR! gyp verb common.gypi checking for gypi file: /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-sass/common.gypi
npm ERR! gyp verb gyp gyp format was not specified; forcing "make"
npm ERR! gyp info spawn /usr/bin/python
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-sass/build/config.gypi',npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/abhijnan/.node-gyp/17.6.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/home/abhijnan/.node-gyp/17.6.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/abhijnan/.node-gyp/17.6.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-sass',npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp verb command build []
npm ERR! gyp verb build type Release
npm ERR! gyp verb architecture x64
npm ERR! gyp verb node dev dir /home/abhijnan/.node-gyp/17.6.0
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: not found: make
npm ERR! gyp ERR! stack at getNotFoundError (/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:13:12)
npm ERR! gyp ERR! stack at F (/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:68:19)
npm ERR! gyp ERR! stack at E (/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:80:29)
npm ERR! gyp ERR! stack at /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/which/which.js:89:16
npm ERR! gyp ERR! stack at /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/isexe/index.js:42:5
npm ERR! gyp ERR! stack at /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/isexe/mode.js:8:5
npm ERR! gyp ERR! stack at FSReqCallback.oncomplete (node:fs:198:21)
npm ERR! gyp ERR! System Linux 4.4.0-19041-Microsoft
npm ERR! gyp ERR! command "/usr/bin/node" "/mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /mnt/c/Users/91967/Desktop/test-wtf/test-yarn/node_modules/node-sass
npm ERR! gyp ERR! node -v v17.6.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR! /home/abhijnan/.npm/_logs/2022-03-07T21_58_47_914Z-debug-0.log
ERROR command failed: npm install --loglevel error --legacy-peer-deps

Did anyone find any solution to this issue?

@John-Njau
Copy link

Incase you encounter the error, just run npm install --loglevel error --legacy-peer-deps this worked for me.

@drakoan
Copy link

drakoan commented Apr 19, 2022

problem log:

npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\DraKoan\AppData\Local\npm-cache\_logs\2022-04-19T17_09_34_388Z-debug-0.log
 ERROR  Error: command failed: npm install --loglevel error --legacy-peer-deps
Error: command failed: npm install --loglevel error --legacy-peer-deps
    at ChildProcess.<anonymous> (C:\Users\DraKoan\AppData\Roaming\npm\node_modules\@vue\cli\lib\util\executeCommand.js:138:16)
    at ChildProcess.emit (node:events:526:28)
    at ChildProcess.cp.emit (C:\Users\DraKoan\AppData\Roaming\npm\node_modules\@vue\cli\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)

Solve:

check proxy at config

npm config edit
npm config --global edit

clean and set proxy

npm config set proxy null
npm config set proxy false

@coderbob1024
Copy link

This problem I also encountered, I was solved like this: use the administrator to open the terminal, run the command, can be solved。 Hope this helps you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests