Geert
Geert

Reputation: 239

Socket timeout when trying to create a new vue project with vue-cli

I'm getting an error when I create a new Vue project using vue-cli. Each time the create fails on a "Socket timeout" but a different request? I updated node using nvm and installed the latest vue-cli.

Terminal shows this:

Vue CLI v4.5.9
✨  Creating project in /Users/me/Documents/GitHub/myproject.
🗃  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/cosmiconfig failed, reason: Socket timeout

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/me/.npm/_logs/2020-12-07T11_02_37_391Z-debug.log
 ERROR  command failed: npm install --loglevel error --legacy-peer-deps

The create tends to fail around the log file is around line 4900. These are the last lines in the log file:

4875 timing idealTree:node_modules/webpack-dev-server/node_modules/anymatch/node_modules/normalize-path Completed in 0ms
4876 timing idealTree:buildDeps Completed in 164233ms
4877 timing idealTree:fixDepFlags Completed in 10ms
4878 timing idealTree Completed in 164265ms
4879 timing command:install Completed in 164269ms
4880 verbose type system
4881 verbose stack FetchError: request to https://registry.npm.taobao.org/cosmiconfig failed, reason: Socket timeout
4881 verbose stack     at ClientRequest.<anonymous> (/Users/me/.nvm/versions/node/v15.3.0/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:97:14)
4881 verbose stack     at ClientRequest.emit (node:events:376:20)
4881 verbose stack     at TLSSocket.socketErrorListener (node:_http_client:490:9)
4881 verbose stack     at TLSSocket.emit (node:events:388:22)
4881 verbose stack     at emitErrorNT (node:internal/streams/destroy:188:8)
4881 verbose stack     at emitErrorCloseNT (node:internal/streams/destroy:153:3)
4881 verbose stack     at processTicksAndRejections (node:internal/process/task_queues:80:21)
4882 verbose cwd /Users/me/Documents/GitHub/myproject
4883 verbose Darwin 19.6.0
4884 verbose argv "/Users/me/.nvm/versions/node/v15.3.0/bin/node" "/Users/me/.nvm/versions/node/v15.3.0/bin/npm" "install" "--loglevel" "error" "--legacy-peer-deps"
4885 verbose node v15.3.0
4886 verbose npm  v7.0.14
4887 error code ERR_SOCKET_TIMEOUT
4888 error errno ERR_SOCKET_TIMEOUT
4889 error request to https://registry.npm.taobao.org/cosmiconfig failed, reason: Socket timeout
4890 verbose exit 1

Upvotes: 1

Views: 1865

Answers (3)

Bob Corlsan
Bob Corlsan

Reputation: 46

I ran into this as well. Fixed it by first running

vue config -e

Then setting this property to false:

{
  "useTaobaoRegistry": false
}

Upvotes: 1

Otto Paulsen
Otto Paulsen

Reputation: 372

Updating to Big Sur did not help me. This, however, helped:

sudo npm uninstall -g vue sudo npm uninstall -g vue-cli sudo npm uninstall -g @vue/cli sudo npm cache clean --force sudo npm install -g vue sudo npm install -g @vue/cli

Upvotes: 0

Geert
Geert

Reputation: 239

Ok, I just updated my os to Big Sur and now it seems to work.

Upvotes: 0

Related Questions