“npm postinstall”未在 docker 中运行

Aun*_*Aun 3 docker

我有一个 angular 应用程序,它需要以下步骤:

  1. 安装
  2. 安装后安装
  3. 运行

我通过 dockerfile 自动执行步骤,以上三个步骤都运行良好,但是当运行 dockerfile 时,它​​会出现缺少“npm postinstall”脚本的错误:

The command '/bin/sh -c npm run postinstall' returned a non-zero code: 1
Run Code Online (Sandbox Code Playgroud)

可能是什么问题?

小智 5

Npm 可能会拒绝使用 root 帐户运行安装后脚本您必须在 docker 中使用非特权用户或直接运行 npm i --unsafe-perm