I'm trying to gitlab's CI/CD and was making a yml-file that build the project. The problem is that I get the following:
$ npm run build
> [email protected] build C:\GitLab-Runner\builds\QLuLhspz\0\I416547\s4-software-fun-frontend
> react-scripts build
Creating an optimized production build...
Treating warnings as errors because process.env.CI = true.
Most CI servers set it automatically.
Failed to compile.
./src/Components/Task/TaskList.js
Line 120:15: 'currentTasks' is assigned a value but never used no-unused-vars
Line 175:25: Headings must have content and the content must be accessible by a screen reader jsx-a11y/heading-has-content
./src/Components/House/House.js
Line 150:16: 'Address' is assigned a value but never used no-unused-vars
Line 150:25: 'HouseNumber' is assigned a value but never used no-unused-vars
Line 150:38: 'City' is assigned a value but never used no-unused-vars
./src/Components/House/HouseList.js
Line 160:25: Headings must have content and the content must be accessible by a screen reader jsx-a11y/heading-has-content
./src/Components/Person/PersonList.js
Line 183:25: Headings must have content and the content must be accessible by a screen reader jsx-a11y/heading-has-content
./src/Components/Footer.js
Line 2:28: 'Row' is defined but never used no-unused-vars
./src/Components/Person/Person.js
Line 4:9: 'Link' is defined but never used no-unused-vars
Line 166:16: 'FullName' is assigned a value but never used no-unused-vars
Line 166:26: 'PhoneNumber' is assigned a value but never used no-unused-vars
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\WINDOWS\system32\config\systemprofile\AppData\Roaming\npm-cache\_logs\2020-05-17T11_42_43_915Z-debug.log
Uploading artifacts for failed job
00:00
ERROR: Job failed: exit status 1
Now it says warnings are set to errors so what I tried doing in my yml-file was adding CI=false
:
stages: ["build", "test", "deploy"]
before_script:
- npm install
- CI=false
build:
stage: build
script: npm run build
test:
stage: test
script: npm run test
deploy:
stage: deploy
script: npm run start
But than it says the command is not recognized. Is it because it's not a powershell command or does react.js use the node-command? (either way it doesn't work)
Sources tried:
EDIT: found the problem....instead of doing it in the yml-file it should've been done in the project itself. How to set environment variable in React JS..?