代码之家  ›  专栏  ›  技术社区  ›  Mr. Boy

我可以命令npm不要尝试从互联网上下载吗?

npm
  •  0
  • Mr. Boy  · 技术社区  · 4 年前

    我已经将npm缓存复制到一台无法访问互联网的机器上。安装时,它会尝试在返回到本地缓存版本之前联机,这似乎会大大降低速度:

    npm安装gulp-g——冗长 npm信息如果以ok结尾,它就起作用了 动词cli[ npm谓词cli'C:\Program Files\nodejs\node。exe', npm谓词cli'C:\Program Files\nodejs\node\u modules\npm\bin\npm cli。js', npm动词cli“安装”, npm动词cli'gulp', npm动词cli'-g', npm动词cli'--详细' npm动词cli] npm信息使用npm@6.14.15 npm信息使用node@v14.17.6 npm动词npm会话85D023355611AB7 npm WARN注册表对的意外警告 https://registry.npmjs.org/ :杂项警告:请求 https://registry.npmjs.org/gulp 失败,原因:connect econnrefuse104.16.18.35:443 npm使用来自的过时数据警告注册表 https://registry.npmjs.org/ 由于重新验证期间的请求错误。 npm http fetch GET 200 https://registry.npmjs.org/gulp 73192ms(来自缓存) npm计时阶段:loadCurrentTree在73766ms内完成 npm计时阶段:loadIdealTree:cloneCurrentTree在3毫秒内完成 npm计时阶段:loadIdealTree:loadShrinkwrap在120ms内完成 npm http fetch GET 200 https://registry.npmjs.org/vinyl-fs 73164ms(来自缓存) npm http fetch GET 200 https://registry.npmjs.org/gulp-cli 73177ms(来自缓存) npm http fetch GET 200 https://registry.npmjs.org/glob-watcher 73180ms(从缓存) npm http fetch GET 200 https://registry.npmjs.org/undertaker 73180ms(从缓存) npm http fetch GET 200 https://registry.npmjs.org/anymatch 73116ms(来自缓存) npm http fetch GET 200 https://registry.npmjs.org/chokidar 73118ms(来自缓存) npm http fetch GET 200 https://registry.npmjs.org/async-done 73122ms(来自缓存) npm http fetch GET 200 https://registry.npmjs.org/normalize-path 73121ms(来自缓存) npm http fetch GET 200 https://registry.npmjs.org/just-debounce 73122ms(来自缓存) npm http fetch GET 200 https://registry.npmjs.org/is-negated-glob 73124ms(来自缓存) npm http fetch GET 200 https://registry.npmjs.org/object.defaults 73126ms(来自缓存)

    所有这些73s的失败都将持续很久。

    我能告诉它“只使用离线缓存”吗?由于一些兼容性问题,我正在对节点14.17.6运行mpm 6.14.15,

    0 回复  |  直到 4 年前
        1
  •  2
  •   Peterrabbit    4 年前

    你可以使用npm --offline 旗帜

    医生 https://docs.npmjs.com/cli/v7/using-npm/config#offline