项目场景:
在学习使用webpack时,发现在vscode当中无法使用npm install 安装相应的东西,并且没有任何错误提示,仅能看到进度条不动的情况。
问题描述:
vscode执行npm install webpack 进度条不动
PS C:\Users\尘寰\Desktop\test> npm install webpack --save-dev
[..................] / rollbackFailedOptional: verb npm-session c3a9fa7cdb4a67d4
原因分析:
国内连接npm网络速度较慢,导致很多东西都无法下载或安装。
解决方案:
使用代理registry
(1)在终端输入 npm config set registry https://registry.npm.taobao.org
(2)再次安装,能够实现相应功能。(下图为安装webpack时呈现)
PS C:\Users\尘寰\Desktop\test> npm config set registry https://registry.npm.taobao.org
PS C:\Users\尘寰\Desktop\test> npm install webpack --save-dev
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"12.18.4","npm":"6.14.6"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
npm WARN test@1.0.0 No description
npm WARN test@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ webpack@4.44.2
added 345 packages from 201 contributors in 13.488s
6 packages are looking for funding
run `npm fund` for details
PS C:\Users\尘寰\Desktop\test>