Vue CLI SOCKET_TIMEOUT error creating new project (npm error)

Viewed 3054

So basically I am trying to set up a new Vue project using vue create vue-first-app and I end up with this error below. I tried to increase the timeout using npm install -timeout=9999999 . I also tried cleaning the npm cashe with npm cache clean --force but it did not help. Does anyone know a way to solve this?

    Vue CLI v4.5.9
✨  Creating project in /home/marius/vue/vue-first-app.
  Initializing git repository...
⚙️  Installing CLI plugins. This might take a while...

npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! request to https://registry.npm.taobao.org/mkdirp failed, reason: Socket timeout

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/marius/.npm/_logs/2020-12-14T09_54_21_447Z-debug.log
 ERROR  command failed: npm install --loglevel error --legacy-peer-deps
4 Answers

Try

Either:

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

OR

Point the npm registry url to http :

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

And then re-run your vue cli command :

vue create vue-first-app

This may help you.

  1. Check if you have a working internet connection (check if the firewall is not blocking the connection request)

  2. Try to go the npm config file and change the time out from there. This issue is commonly caused when one of these two reasons occur. Path: installationDirectory\nodejs\node_modules\npm and open the .npmrc file and try changing the time out from there.

Also refer: https://docs.npmjs.com/common-errors

Had the same problem.

For me, using sudo worked.

sudo vue create vue-first-app

Good luck!

Related