我有一个针对 Angular 项目的 GitLab 流水线,其中包含在
.gitlab-ci.yml
中的图像。image: node:16
build:
stage: build
script:
- npm ci
- nodejs -v
- npm -v
- npm run build:prod
- npm doctor
当管道到达npm doctor
时,如果npm版本为以下版本,则会出现以下错误:
$ npm doctor
Check Value Recommendation/Notes
npm ping ok
npm -v not ok Use npm v7.24.0
node -v ok current: v16.9.1, recommended: v16.9.1
npm config get registry ok using default registry (https://registry.npmjs.org/)
which git ok /usr/bin/git
Perms check on cached files ok
Perms check on local node_modules ok
Perms check on global node_modules ok
Perms check on local bin folder ok
Perms check on global bin folder ok
Verify cache contents ok verified 1361 tarballs
我该如何解决这个问题?
在我的机器上,npm版本是v7.24.0,命令执行成功。
npm doctor
和npm ci
之前添加了npm install npm@7.24.0
,但是在npm -v
上仍然抛出相同的错误。另外,我正在寻找 GitLab 的setup-node
。 - adrisons