我可以命令 npm 不要尝试从 Internet 下载任何内容吗?
Can I command npm not to attempt any downloads from the internet?
我已经将 npm 缓存复制到无法访问互联网的机器上。安装时,它会在回退到本地缓存版本之前尝试上线,这似乎大大降低了速度:
npm install gulp -g --verbose
npm info it worked if it ends with ok
npm verb cli [
npm verb cli 'C:\Program Files\nodejs\node.exe',
npm verb cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
npm verb cli 'install',
npm verb cli 'gulp',
npm verb cli '-g',
npm verb cli '--verbose'
npm verb cli ]
npm info using npm@6.14.15
npm info using node@v14.17.6
npm verb npm-session 85d023355611a2b7
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ECONNREFUSED: request to https://registry.npmjs.org/gulp failed, reason: connect ECONNREFUSED 104.16.18.35:443
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm http fetch GET 200 https://registry.npmjs.org/gulp 73192ms (from cache)
npm timing stage:loadCurrentTree Completed in 73766ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 3ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 120ms
npm http fetch GET 200 https://registry.npmjs.org/vinyl-fs 73164ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/gulp-cli 73177ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/glob-watcher 73180ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/undertaker 73180ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/anymatch 73116ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/chokidar 73118ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/async-done 73122ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/normalize-path 73121ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/just-debounce 73122ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/is-negated-glob 73124ms (from cache)
npm http fetch GET 200 https://registry.npmjs.org/object.defaults 73126ms (from cache)
所有这些 73 年代的失败都是永远的。
我可以告诉它“只使用离线缓存”吗?由于一些兼容性问题,我 运行 mpm 6.14.15 针对节点 14.17.6,
您可以使用 npm --offline
标志
我已经将 npm 缓存复制到无法访问互联网的机器上。安装时,它会在回退到本地缓存版本之前尝试上线,这似乎大大降低了速度:
npm install gulp -g --verbose npm info it worked if it ends with ok npm verb cli [ npm verb cli 'C:\Program Files\nodejs\node.exe', npm verb cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', npm verb cli 'install', npm verb cli 'gulp', npm verb cli '-g', npm verb cli '--verbose' npm verb cli ] npm info using npm@6.14.15 npm info using node@v14.17.6 npm verb npm-session 85d023355611a2b7 npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning ECONNREFUSED: request to https://registry.npmjs.org/gulp failed, reason: connect ECONNREFUSED 104.16.18.35:443 npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation. npm http fetch GET 200 https://registry.npmjs.org/gulp 73192ms (from cache) npm timing stage:loadCurrentTree Completed in 73766ms npm timing stage:loadIdealTree:cloneCurrentTree Completed in 3ms npm timing stage:loadIdealTree:loadShrinkwrap Completed in 120ms npm http fetch GET 200 https://registry.npmjs.org/vinyl-fs 73164ms (from cache) npm http fetch GET 200 https://registry.npmjs.org/gulp-cli 73177ms (from cache) npm http fetch GET 200 https://registry.npmjs.org/glob-watcher 73180ms (from cache) npm http fetch GET 200 https://registry.npmjs.org/undertaker 73180ms (from cache) npm http fetch GET 200 https://registry.npmjs.org/anymatch 73116ms (from cache) npm http fetch GET 200 https://registry.npmjs.org/chokidar 73118ms (from cache) npm http fetch GET 200 https://registry.npmjs.org/async-done 73122ms (from cache) npm http fetch GET 200 https://registry.npmjs.org/normalize-path 73121ms (from cache) npm http fetch GET 200 https://registry.npmjs.org/just-debounce 73122ms (from cache) npm http fetch GET 200 https://registry.npmjs.org/is-negated-glob 73124ms (from cache) npm http fetch GET 200 https://registry.npmjs.org/object.defaults 73126ms (from cache)
所有这些 73 年代的失败都是永远的。
我可以告诉它“只使用离线缓存”吗?由于一些兼容性问题,我 运行 mpm 6.14.15 针对节点 14.17.6,
您可以使用 npm --offline
标志