【问题标题】:All `npm install` in docker gets corrupteddocker 中的所有 `npm install` 都已损坏
【发布时间】:2021-02-25 14:10:34
【问题描述】:

我尝试创建的所有 docker 映像在运行 npm install 时都已损坏。

其中两张图片出现了这样的错误:

[stage-1 4/5] RUN npm install -g pm2 --loglevel warn
       → npm ERR! Unexpected end of JSON input while parsing near '..."2.3.7","dependencies'

然后这个

   [src  4/20] RUN npm install lerna --global
       → npm ERR! Unexpected end of JSON input while parsing near '.../changed","version":"'

而其他人只是在安装与 lerna 相关的任何东西时卡住了。

我的同事没有这个问题,因此在构建步骤中更改任何内容都没有任何意义。

我对此感到很困惑。

注意:我已运行 docker system prune -a 删除所有缓存,以便重新开始,但问题仍然存在。

【问题讨论】:

    标签: docker npm lerna


    【解决方案1】:

    您可以尝试设置注册表吗?

    npm config set registry https://registry.npmjs.org/
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-10
      • 1970-01-01
      相关资源
      最近更新 更多