Vue create “projectName” ERR_SOCKET_TIMEOUT - 无论如何总是失败 - 淘宝

Vue create “projectName” ERR_SOCKET_TIMEOUT - fails all the time no matter what - taobao

我对最近发生在我身上的事情感到有点困惑。

每当我想创建一个新的 vue 项目时,它都会失败:

Vue CLI v4.5.11
✨  Creating project in /home/admin/Documents/dev/my_projects/vThesaurus/thesaurus.
⚙️  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/jsonfile failed, reason: Socket timeout

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/admin/.npm/_logs/2021-03-17T06_40_10_793Z-debug.log
ERROR  command failed: npm install --loglevel error --legacy-peer-deps

之前尝试的另一个包:

request to https://registry.npm.taobao.org/core-js-compat failed, reason: Socket timeout
request to https://cdn.npm.taobao.org/micromatch/-/micromatch-4.0.2.tgz failed, reason: Socket timeout
request to https://registry.npm.taobao.org/querystring-es3 failed, reason: Socket timeout
request to https://registry.npm.taobao.org/file-loader failed, reason: Socket timeout

……还有更多

日志:(最后一部分)

4675 timing command:install Completed in 378261ms
4676 verbose type system
4677 verbose stack FetchError: request to https://registry.npm.taobao.org/jsonfile failed, reason: Socket timeout
4677 verbose stack     at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/minipass-fetch/lib/index.js:97:14)
4677 verbose stack     at ClientRequest.emit (events.js:315:20)
4677 verbose stack     at TLSSocket.socketErrorListener (_http_client.js:463:9)
4677 verbose stack     at TLSSocket.emit (events.js:327:22)
4677 verbose stack     at emitErrorNT (internal/streams/destroy.js:100:8)
4677 verbose stack     at emitErrorCloseNT (internal/streams/destroy.js:68:3)
4677 verbose stack     at processTicksAndRejections (internal/process/task_queues.js:84:21)
4678 verbose cwd /home/admin/Documents/dev/my_projects/vThesaurus/thesaurus
4679 verbose Linux 5.4.0-67-generic
4680 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--loglevel" "error" "--legacy-peer-deps"
4681 verbose node v14.2.0
4682 verbose npm  v7.6.3
4683 error code ERR_SOCKET_TIMEOUT
4684 error errno ERR_SOCKET_TIMEOUT
4685 error request to https://registry.npm.taobao.org/jsonfile failed, reason: Socket timeout
4686 verbose exit 1
the weirdest part is that it always fails on a different package …

我试过了:

似乎没有任何效果……


npm -v 7.6.3

vue --version @vue/cli 4.5.11

OS: Ubuntu 20.04.2 LTS 64 位

Gnome 版本:3.36.8

我错过了什么?

看来您确实对淘宝有疑问。从此github thread,我们可能会尝试不再使用它。

为此,您可以转到 ~/.vuerc 并设置 "useTaobaoRegistry": false


yarn config get registry 给我 https://registry.yarnpkg.com.