I am trying to use react-native-web in my college project.
When I lint with ESlit in local, it will be no error. But when the code is running on the Gitlab-CI pipeline, it always show this error when doing lint:
Error: ESLint configuration in /builds/PPL2018csui/Kelas-A/Kel-5/functions/node_modules/grpc/node_modules/uuid/.eslintrc.json is invalid:
- Unexpected top-level property "installedESLint".
I already have my own .eslintrc file, but the ESlint always refer to uuid/.eslintrc.json.
This is my gitlab-ci.yml file:
image: node:8
before_script:
- npm install
cache:
paths:
- node_modules/
stages:
- test
- build
- deploy
test:
stage: test
script:
- npm install -g codecov
- npm run lint
- npm test && codecov --token=<TOKEN>
build:
stage: build
script: ./node_modules/.bin/webpack
deploy_staging:
stage: deploy
script:
- ./node_modules/.bin/webpack --config webpack.config.js
- git remote add heroku https://heroku:<TOKEN>#git.heroku.com/<MY-APP>.git
- git push -f heroku HEAD:master
environment:
name: staging
url: https://<MY-APP>.herokuapp.com/
This is the pipeline result:
Running with gitlab-runner 10.6.0-rc1 (0a9d5de9)
on docker-auto-scale 72989761
Using Docker executor with image node:8 ...
Pulling docker image node:8 ...
Using docker image <DOCKER-IMAGE> for node:8 ...
Running on <RUNNER-CONCURRENT> via <OTHER-RUNNER>...
Cloning repository...
Cloning into '/builds/PPL2018csui/Kelas-A/Kel-5'...
Checking out 4a8b0c7e as group_chat_react...
Skipping Git submodules setup
Checking cache for default...
Downloading cache.zip from <CACHE-URL>
Successfully extracted cache
$ npm install
> uglifyjs-webpack-plugin#0.4.6 postinstall /builds/PPL2018csui/Kelas-A/Kel-5/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 1360 packages in 34.056s
$ npm install -g codecov
/usr/local/bin/codecov -> /usr/local/lib/node_modules/codecov/bin/codecov
+ codecov#3.0.0
added 58 packages in 2.266s
$ npm run lint
> deco#0.0.1 lint /builds/PPL2018csui/Kelas-A/Kel-5
> eslint --ext .js .
ESLint configuration in /builds/PPL2018csui/Kelas-A/Kel-5/functions/node_modules/grpc/node_modules/uuid/.eslintrc.json is invalid:
- Unexpected top-level property "installedESLint".
Error: ESLint configuration in /builds/PPL2018csui/Kelas-A/Kel-5/functions/node_modules/grpc/node_modules/uuid/.eslintrc.json is invalid:
- Unexpected top-level property "installedESLint".
at validateConfigSchema (/builds/PPL2018csui/Kelas-A/Kel-5/node_modules/eslint/lib/config/config-validator.js:221:15)
at Object.validate (/builds/PPL2018csui/Kelas-A/Kel-5/node_modules/eslint/lib/config/config-validator.js:238:5)
at loadFromDisk (/builds/PPL2018csui/Kelas-A/Kel-5/node_modules/eslint/lib/config/config-file.js:516:19)
at Object.load (/builds/PPL2018csui/Kelas-A/Kel-5/node_modules/eslint/lib/config/config-file.js:559:20)
at Config.getLocalConfigHierarchy (/builds/PPL2018csui/Kelas-A/Kel-5/node_modules/eslint/lib/config.js:227:44)
at Config.getConfigHierarchy (/builds/PPL2018csui/Kelas-A/Kel-5/node_modules/eslint/lib/config.js:179:43)
at Config.getConfigVector (/builds/PPL2018csui/Kelas-A/Kel-5/node_modules/eslint/lib/config.js:286:21)
at Config.getConfig (/builds/PPL2018csui/Kelas-A/Kel-5/node_modules/eslint/lib/config.js:329:29)
at processText (/builds/PPL2018csui/Kelas-A/Kel-5/node_modules/eslint/lib/cli-engine.js:163:33)
at processFile (/builds/PPL2018csui/Kelas-A/Kel-5/node_modules/eslint/lib/cli-engine.js:224:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! deco#0.0.1 lint: `eslint --ext .js .`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the deco#0.0.1 lint 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! /root/.npm/_logs/2018-03-20T06_38_47_590Z-debug.log
ERROR: Job failed: exit code 1
Is there anyone who can help me with the error?
You can remove the entry "installedESLint:true". It was a bug which put that entry on init as mentioned here
Related
The following chain of events had occured.
The Angular website application was pretty outdated, possibly v3 and was upgraded to 8.2.8, couldnt go all the way due to a dependency on mdbbootstrap which would require a rewrite in many places, made a change and the pipeline and check completed.
Coming back from another project i ran into this problem Angular project produces javascript error "core.js:23018 Uncaught TypeError: Cannot read properties of undefined (reading 'id')", which was solved by npm -ci
Now after making my current changes, and sending off to gitlab pipeline, the following errors occur
npm ERR! While resolving: angular-date-value-accessor#0.0.1
npm ERR! Found: #angular/core#8.2.14
npm ERR! node_modules/#angular/core
npm ERR! #angular/core#"~8.2.8" from the root project
npm ERR! peer #angular/core#"8.2.14" from #angular/animations#8.2.14
npm ERR! node_modules/#angular/animations
npm ERR! #angular/animations#"~8.2.8" from the root project
npm ERR! peer #angular/animations#">=6.0.0 <9.0.0" from angular-calendar#0.26.11
npm ERR! node_modules/angular-calendar
npm ERR! angular-calendar#"^0.26.11" from the root project
npm ERR! 23 more (#angular/common, #angular/forms, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer #angular/core#"^2.0.0" from angular-date-value-accessor#0.0.1
npm ERR! node_modules/angular-date-value-accessor
npm ERR! angular-date-value-accessor#"0.0.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: #angular/core#2.4.10
npm ERR! node_modules/#angular/core
npm ERR! peer #angular/core#"^2.0.0" from angular-date-value-accessor#0.0.1
npm ERR! node_modules/angular-date-value-accessor
npm ERR! angular-date-value-accessor#"0.0.1" from the root project
this is the gitlab-ci yaml
stage: build_staging
image: node:lts
script:
- grep -rli '%COMMIT_HASH%' * | xargs -i# sed -i "s/%COMMIT_HASH%/$CI_COMMIT_SHORT_SHA/g" #
- cd src/Web
- npm install
- npm run buildstaging
artifacts:
paths:
- src/Web/dist/
name: "$CI_JOB_NAME-$CI_COMMIT_REF_NAME"
only:
refs:
- develop
Deploy Web Staging:
stage: deploy_staging
image: xueshanf/awscli
script:
- cd src/Web
- aws s3 sync ./dist s3://$STAGING_BUCKET_NAME/ --delete
- echo "Invalidate index.html"
- aws cloudfront create-invalidation --distribution-id $STAGING_DISTRIBUTION_ID --paths /index.html
only:
refs:
- develop
(fyi its the build_staging that is the problem)
I am assuming what was fixed on my local machine is now no longer valid for npm install on npm:lts
What would be the proper course of direction, is it as simple as
npm ci( a very demanding operation) instead of npm install ? or git clean ?
I also noticed, although everything works fine locally
in package.json and lock it has
"#angular/core": "~8.2.8",
but in my node_modules it has 8.2.14 in /#angular/core/
after running npm ci
ok here is what i did to get it working. This would not be a problem if ng commands would work so it could auto resolve dependency problems. Each problem gitlab complained about i manually uninstalled and installed to see the error, and its dependency issue. I upgraded either the component or dependency. until all were gone. Some components had to go completely, but none required a re-code of any usage (i think so far, it hasnt been fully tested).
Now when i finally resolved all these issues, i would get errors such as this
npm ERR! path /builds/0/WebSites/customerportal/CustomerPortal/src/Web/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /usr/local/bin/node /builds/0/WebSites/customerportal/CustomerPortal/src/Web/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
allot more all pointing to gyp, and some problem with python version.
I changed the version of the image to Node:14 in the yaml file, and the building stage would complete. Also, the deploy stage would complete, (but the C# api layers time out on warning: 8 tasks failed to start
I have been attempting to set up auto-deploy from my github repo for this simple REST API and cannot get it to stop erroring on 'npm install'. It is your basic node project with express. Here is my buildspec.yml:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 10
commands:
- echo Installing
pre_build:
commands:
- echo Installing source NPM dependencies.
- npm install
build:
commands:
- echo Build started on `date`
- echo Compiling the Node.js code
- npm run build
post_build:
commands:
- echo Build completed on `date`
artifacts:
files:
- '**/*'
Here is the error prinout from AWS CodeBuild:
[Container] 2022/05/15 21:13:45 Running command npm install
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion#1, but package-lock.json was generated for lockfileVersion#2. I'll try to do my best with it!
npm WARN wts_api#1.0.0 No description
npm WARN wts_api#1.0.0 No repository field.
npm ERR! code EEXIST
npm ERR! path /codebuild/output/src331276253/src/node_modules/.bin/nodemon
npm ERR! Refusing to delete /codebuild/output/src331276253/src/node_modules/.bin/nodemon: is outside /codebuild/output/src331276253/src/node_modules/nodemon and not a link
npm ERR! File exists: /codebuild/output/src331276253/src/node_modules/.bin/nodemon
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-05-15T21_13_48_178Z-debug.log
[Container] 2022/05/15 21:13:48 Command did not exit successfully npm install exit status 1
[Container] 2022/05/15 21:13:48 Phase complete: PRE_BUILD State: FAILED
[Container] 2022/05/15 21:13:48 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm install. Reason: exit status 1
I think I've done this 100% as convention dictates, except for maybe my project structure. Rather than having all my files in 'src', they are in the root of the project.
Maybe you found the answer already, but for future readers, here it goes:
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion#1, but package-lock.json was generated for lockfileVersion#2. I'll try to do my best with it!
According to this message, the reason why the install fails is because you used different versions of npm on local machine vs on codebuild.
Your codebuild is using nodejs: 10 runtime, so according to the screenshot below (taken from https://nodejs.org/en/download/releases/), it must be using npm v6.8.x that comes with that version of node.
That version of npm generates/reads package-lock.json file with a version 1 format, while your local npm has generated a package-lock.json with the version 2 format, most certainly because you are on npm v7 or later.
Solution:
Update npm version in the pre-build phase of your Codebuild, as such:
pre_build:
commands:
- echo Installing source NPM dependencies.
- npm install -g npm#<your_local_version_here>
- npm ci
Also, it better to use npm ci rather than npm install on CI, because the former leverage the existing package-lock.json to ensure reproductible builds.
I'd like to execute my unit tests using JEST on GITLAB, but it seeem's not working.
It works on my local machine but not on GitLab.
The entire code of .gitlab-ci.yml :
image: node:16
cache:
paths:
- node_modules
install:
stage: build
script: npm ci
jest:
stage: test
script: npm run test:ci
artifacts:
when: always
reports:
junit:
- junit.xml
Package.json
"test": "jest",
"test:ci": "jest --config ./jest.config.js --ci --reporters=default --reporters=jest-junit"
Error :
npm ERR! code E401
npm ERR! Incorrect or missing password.
npm ERR! If you were trying to login, change your password, create an
npm ERR! authentication token or enable two-factor authentication then
npm ERR! that means you likely typed your password in incorrectly.
npm ERR! Please try again, or recover your password at:
npm ERR! https://www.npmjs.com/forgot
npm ERR!
npm ERR! If you were doing some other operation then your saved credentials are
npm ERR! probably out of date. To correct this please try logging in again with:
npm ERR! npm login
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-05-12T08_05_01_634Z-debug-0.log
Cleaning up project directory and file based variables
00:01
ERROR: Job failed: exit code 1
I found the issue by replacing the Node version (same version in my local machine) : image: node:14.
You need to have a step to install, better to check with GitLab CI document
image: node:16
cache:
paths:
- node_modules
install:
stage: build
script: npm ci
jest:
stage: test
script: npm run test:ci
artifacts:
when: always
reports:
junit:
- junit.xml
I am trying to get a site to deploy to Firebase using TravisCI. I keep running into an issue when the functions deploy and try to run lint. eslint doesn't seem to be there, even though I added a command to cd and npm install. I'm sure this is some kind of no-brainer. What am I missing?
Here's my .travis.yml:
language: node_js
node_js:
- 12
deploy:
provider: firebase
project: "*****"
message: "Deployed from Github by TravisCI"
token:
secure:
*******
env:
global:
secure:
*****
branches:
only:
- master
before_deploy:
- npm install -g gatsby-cli
- rm -rf node_modules/*/.git/
- npm install
- gatsby build
- cd functions && npm install --dev && cd ..
Here's the error in the Travis log:
Installing deploy dependencies
dpl.2
Preparing deploy
dpl.3
Deploying application
=== Deploying to 'covid19-reports'...
i deploying storage, firestore, functions, hosting
Running command: npm --prefix "$RESOURCE_DIR" run lint
> functions# lint /home/travis/build/amygroshek/covid19reports/functions
> eslint .
sh: 1: eslint: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! functions# lint: `eslint .`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the functions# lint script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /home/travis/.npm/_logs/2020-03-23T00_34_17_951Z-debug.log
Error: functions predeploy error: Command terminated with non-zero exit code1
We created a vuejs library proyect in Gitlab and created a simple pipelines that excecuted after when we pushed the commit.
We have a problem when last job execute the npm version patch (that update the patch in the project) but... it's not updated and it's doesn't work.
.gutlab-ci.yml
image: node:8.10.0-slim
cache:
paths:
- node_modules/
before_script:
- npm install
stages:
- lint
- test
- deploy
test:
stage: test
script:
- npm run peers:add && npm run test:unit
tags:
- docker
lint:
stage: lint
script:
- npm run lint
coverage: /All files[^|]*\|[^|]*\s+([\d\.]+)/
publish:
stage: deploy
script:
- npm run peers:remove
- echo -e "//gitlab.com/api/v4/projects/<my-project>/packages/npm/:_authToken=${CI_NPM_TOKEN}" > ~/.npmrc
- npm login
- npm version patch
- npm publish
And package.json
[...]
"scripts": {
...
"build:dev": "npm run clean && webpack --config build/webpack.config.dev.js",
"version": "npm run build:dev && git add -A dist",
"postversion": "git push --follow-tags"
...
}
[...]
Jobs lint and test working but the publish not.
[...]
removed 4 packages in 9.428s
$ echo -e "//gitlab.com/api/v4/projects/<my-project>/packages/npm/:_authToken=${CI_NPM_TOKEN}" > ~/.npmrc
$ npm login
Username: npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/...-debug.log
ERROR: Job failed: exit code 1
We need when the Merge Request it's accepted, automatically builed library and upload to npm repository with a new version (new patch, npm version patch). It's possible?
Thx.
npm login is an interactive command so doesn't work in CI very well. Try using the package npm-login-noninteractive to pass your credentials via command line. You can install it globally in your before_script:
before_script:
- npm i -g npm-login-noninteractive
Then call it in place of npm login in your publish script.