Problem to solve
gitlab ci failed build
$ npm run build
webpack
1: webpack: not found
Cleaning up project directory and file based variables00:00
ERROR: Job failed: command terminated with exit code 1
Steps to reproduce
Which troubleshooting steps have you already taken? Can you link to any docs or other resources so we know where you have been?
Configuration
.gitlab-ci.yml
build qa:
stage: build
extends:
- .add-medium-runner-tag
- .add-role-auth
variables:
DEPLOYMENT: qa
NODE_ENV: production
ROOT: qa/$CI_MERGE_REQUEST_ID
before_script:
# With NODE_ENV=production, clean up dev node modules
- npm install
script:
- npm run build
only:
- merge_requests
package.json
"scripts": {
"build": "webpack",
"build:qa": "cross-env DEPLOYMENT=qa NODE_ENV=production webpack",
...
},
"devDependencies": {
...
"webpack": "^5.91.0",
"webpack-cli": "^5.1.4",
}
### Versions
$ npm -v
10.7.0
[node -v
v18.20.3