Gitlab-ci-multi-runner continues if npm publish fails - gitlab-ci

I use gitlab-ci-multi-runner to publish our artifact to our own npm registry. This is the .gitlab-ci.yml file:
publish-continuous:
type: publish
script:
- npm install
- npm run test
- npm run build
- npm publish --registry $env:NPM_REGISTRY_URL
Sometimes the npm publish fails. This is the output:
$ npm publish --registry $env:NPM_REGISTRY_URL
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\SomeUser\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "publish" "--registry" "https://ourownregistry"
npm ERR! node v4.2.6
npm ERR! npm v3.6.0
npm ERR! code ENEEDAUTH
I would expect that the gitlab-ci-multi-runner stops because the job fails. But it doesn't! It reports Build succeeded.
Anyone knows how I can make the build fail if npm publish fails?

Fixed it by updating to the latest NPM. v3.8.1 fixed the issue. Now it returns a -1 exit code and the build fails.

Related

error while running "npm run build" in vue application

I have cloned vue application from git hub(https://github.com/jimmerioles/progressive-weather-app), for automating the deployment in jenkins. Before doing it, i am checking in my ubuntu machine(GCP vm). There i have installed java,nodejs, npm and vuecli. When i execute a command "npm run build" getting the below error. I tried re-installing vuecli, nodejs and npm also., still getting the same error. Kindly let me know how can i fix this.
npm version is "6.2.0", nodejs version is "v14.3.0" and vuecli is a latest one.
root#instance-2:~/weather/src# npm run build
> PWeatherApp#0.1.0 build /root/weather
> vue-cli-service build
sh: 1: vue-cli-service: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! PWeatherApp#0.1.0 build: `vue-cli-service build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the PWeatherApp#0.1.0 build 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! /root/.npm/_logs/2020-05-23T18_32_20_092Z-debug.log
its may help you:
npm install -g #vue/cli
# OR
yarn global add #vue/cli

installation of Bower : getting npm ERR

I have node and nodenv installed on my Ubuntu 16.04
I want to install bower
npm install -g bower
I am getting this :
npm WARN deprecated bower#1.8.2: ...psst! Your project can stop
working at any moment because its dependencies can change. Prevent
this by migrating to Yarn:
https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm ERR! Linux 4.4.0-94-generic
npm ERR! argv "/home/mypc/.nodenv/versions/4.6.0/bin/node" "/home/mypc/.nodenv/versions/4.6.0/bin/npm" "install" "-g"
"bower"
npm ERR! node v4.6.0
npm ERR! npm v2.15.9
npm ERR! shasum check failed for /tmp/npm-4594-c12fe2a2/registry.npmjs.org/bower/-/bower-1.8.2.tgz
npm ERR! Expected: adf53529c8d4af02ef24fb8d5341c1419d33e2f7
npm ERR! Actual: ca90d0b92af2557a3f8e9116ba83b3fc4ad7828
npm ERR! From: https://registry.npmjs.org/bower/-/bower-1.8.2.tgz
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues>
The npm client is unable to verify the downloaded file from the npm registry:
shasum check failed for /tmp/npm-4594-c12fe2a2/registry.npmjs.org/bower/-/bower-1.8.2.tgz
Expected: adf53529c8d4af02ef24fb8d5341c1419d33e2f7
Actual: ca90d0b92af2557a3f8e9116ba83b3fc4ad7828
How to fix?
If you have a corporate proxy in between, make sure it doesn't modify the content of your downloaded files.
If there is no proxy involved, retry the installation.

ElectronJs: Not able to install "install.js:22 throw err"

I am starting with Electron js and I have stumbled on the very first step which is installed Electron.
I am running the following command to install electron provided at
source
npm install electron-prebuilt --save-dev
Following is the result of the command
C:\Users\vikas\Desktop\electron apps\example>npm install electron-prebuilt --sa
ve-dev
electron-prebuilt#0.37.8 postinstall C:\Users\vikas\Desktop\electron apps\exa
mple\node_modules\electron-prebuilt
node install.js
C:\Users\vikas\Desktop\electron apps\example\node_modules\electron-prebuilt\ins
tall.js:22
throw err
^
Error: end of central directory record signature not found
at C:\Users\vikas\Desktop\electron apps\example\node_modules\yauzl\index.js
:167:14
at C:\Users\vikas\Desktop\electron apps\example\node_modules\yauzl\index.js
:473:5
at C:\Users\vikas\Desktop\electron apps\example\node_modules\fd-slicer\inde
x.js:32:7
at FSReqWrap.wrapper as oncomplete
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\vikas\Desktop
\electron apps\example\package.json'
npm WARN example No description
npm WARN example No repository field.
npm WARN example No README data
npm WARN example No license field.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\vikas\AppData\
\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "electron-prebuilt"
"--save-dev"
npm ERR! node v4.4.3
npm ERR! npm v3.8.9
npm ERR! code ELIFECYCLE
npm ERR! electron-prebuilt#0.37.8 postinstall: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron-prebuilt#0.37.8 postinstall script 'node install
.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electron-prebuilt pac
kage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs electron-prebuilt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\vikas\Desktop\electron apps\example\npm-debug.log
Windows 8.1
NPM Version 3.8.9
Does C:\Users\vikas\Desktop\electron apps\example\package.json exist? If not try running npm init to create it, and then run npm install electron-prebuilt --save-dev again.
this is bug and a workaround is provided on github : Source
Here is the workaround:
rm -rf ~/.electron/
rm -rf ~/.atom/
npm cache clear
npm install
I was facing a similar issue. But opening the command prompt as administrator (Windows) and reinstalling electron fixed the issue.

How to Fix Error "user admin is not allowed to access package"

I am updated now and running
node v5.0.0
npm v3.3.6
On a Mac (El Capitan)
When i run "npm install" on my project now. I get errors like this:
me:controls me$ sudo npm install
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/Cellar/node/0.10.36/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.0.0
npm ERR! npm v3.3.6
npm ERR! code E403
npm ERR! user admin is not allowed to access package chai : chai
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /Users/me/Dev/controls/npm-debug.log
Im not seeing any solutions to this around the web yet? I tried both sudo and not sudo and makes no difference.
Any suggestions?
I had the same problem. Check the registry: npm config list.
Try to run:
npm set registry "https://registry.npmjs.org/"
and then npm i again.
I used sinopia as a registry. Sinopia can't work with scoped packages.

npm install error Failed at the phantomjs#1.9.12 install script

I am getting this error when am trying to do npm install...am struck with this nearly for 4 days...please can someone help me out...
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "c:\\Program Files\\nodejs\\node.exe" "c:\\Users\\Username\\AppData\\Roaming\\npm\\node_modules\\n pm\\bin\\npm-cli.js" "install"
npm ERR! node v0.10.33
npm ERR! npm v2.1.5
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! phantomjs#1.9.12 install: `node install.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the phantomjs#1.9.12 install script.
npm ERR! This is most likely a problem with the phantomjs package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get their info via:
npm ERR! npm owner ls phantomjs
npm ERR! There is likely additional logging output above.
I had the exact same issue on Windows. To fix it, I took the following steps:
Install the latest version of phantomjs (currently, phantomjs-1.9.8-windows) locally, by downloading and unziping. I had a previous version which was not compatible with phantomjs npm package.
Update your environment variable to point to latest version of phantomjs.exe (PHANTOMJS_HOME).
Exit and restart windows prompt or shell to recognize variable.
Now, npm install or specifically, npm install phantomjs#1.9.12 should work correctly.
You can test your local phantomjs executable install with a where phantomjs and phantomjs -v from a git bash shell or command prompt.
I am working under a corporate proxy, So it was blocking npm to download 'phantom' from https://github.com/Medium/phantomjs/releases/download/v2.1.1/phantomjs-2.1.1-windows.zip
So, I fixed it in the following way...
Download 'phantomjs-2.1.1-windows.zip' file from the above link directly.
Copy and paste it to 'C:\Users\user_name\AppData\Local\Temp\phantomjs\phantomjs-2.1.1-windows.zip'
Now, just do 'npm install', it will work like a charm.
Read the error and find the correct version of phantomjs (might be 1.9.12 or 2.1.1 ).
Find the appropriate file in the maven repo.
Download the zip file and copy the same zip file to C:\Users\User_ID\AppData\Local\Temp\phantomjs\ and paste it (in zip format).
Set or create an environment variable PHANTOMJS_HOME
to C:\Users\User_ID\AppData\Local\Temp\phantomjs\phantomjs-1.9.8-windows.zip.
restart the command prompt and run npm i or npm install