在我的服务器上,我已经配置了GitLab Runner使用 shell
执行器。并且 which node
命令的输出为:/home/ubuntu/.nvm/versions/node/v14.11.0/bin/node
。
因此,我的gitlab-ci.yml文件如下:
stages:
- prepare
- check
- deploy
default:
before_script:
- export PATH=$PATH:/home/ubuntu/.nvm/versions/node/v14.11.0/bin
prepare:
stage: prepare
only:
refs:
- dev
before_script:
- export PATH=$PATH:/home/ubuntu/.nvm/versions/node/v14.11.0/bin
script:
- npm i --ignore-scripts --include=dev
cache:
key: $CI_COMMIT_BRANCH
paths:
- node_modules/
prepare
任务报错 npm: command not found
,导致流水线失败。如何解决此问题?