使用VS2017还原NPM包时,因为要访问外网,安装时间特别漫长,而且等待很长时间也可能安装错误
npm安装
淘宝 NPM 镜像:一个完整 npmjs.org 镜像,你可以用此代替官方版本(只读),同步频率目前为 10分钟 一次以保证尽量与官方服务同步。
安装淘宝镜像
Npm配置默认选项
需要添加以下路径
C:\Program Files\nodejs
C:\Users\82511\AppData\Roaming\npm
D:\Program Files\Git\bin
配置淘宝镜像
再次还原npm,出现如下的安装信息。
PATH=.\node_modules\.bin;%PATH%;d:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\cmd;d:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\CommonExtensions\Microsoft\TeamFoundation\Team Explorer\Git\mingw32\bin;C:\Program Files\nodejs;C:\Users\82511\AppData\Roaming\npm;D:\Program Files\Git\bin "C:\Program Files\nodejs\npm.CMD" install Vue@0.0.0 E:\COLDDEMO\Vue +-- @types/webpack-env@1.13.0 +-- abbrev@1.1.0 +-- acorn@5.0.3 +-- acorn-dynamic-import@2.0.2 | `-- acorn@4.0.13 +-- ajv@5.2.0 +-- ajv-keywords@1.5.1 +-- align-text@0.1.4 +-- alphanum-sort@1.0.2 +-- ansi-html@0.0.7 +-- ansi-regex@2.1.1 +-- ansi-styles@2.2.1 +-- anymatch@1.3.0 +-- argparse@1.0.9 +-- arr-diff@2.0.0 +-- arr-flatten@1.0.3 +-- array-unique@0.2.1 +-- arrify@1.0.1 +-- asn1.js@4.9.1 | `-- memory-fs@0.4.1 +-- webpack-hot-middleware@2.18.0 +-- webpack-node-externals@1.6.0 +-- webpack-sources@1.0.1 | `-- source-list-map@2.0.0 +-- whatwg-fetch@2.0.3 +-- whet.extend@0.9.9 +-- which-module@1.0.0 +-- window-size@0.1.0 +-- wordwrap@0.0.2 +-- wrap-ansi@2.1.0 +-- xtend@4.0.1 +-- y18n@3.2.1 +-- yallist@2.1.2 +-- yargs@6.6.0 | +-- camelcase@3.0.0 | `-- cliui@3.2.0 `-- yargs-parser@4.2.1 `-- camelcase@3.0.0 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
Npm还原成功示意图
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持。