Npm install error

Well I have a debian with docker 25.0.1 and this containers , gitlab, jenkins, nexus and wildfly, nexus and wildfly forget it. I am tryin to clone from gitlab to jenkins, and all was ok, after that I did maven and all ok, buy after that , the next step is make npm install, npm run build, npm start but doen´t work.

Jenkins give me this error with local installation /usr/bin/node don´t find and in the jenkins grlobal tools tells me this:“/usr/bin/node is not a directory on the Jenkins controller (but perhaps it exists on some agents)”, I tried to make another installation but the error is the next:

  • npm install npm ERR! code E403 npm ERR! 403 403 Forbidden - GET https://registry.npmjs.org/tslib/-/tslib-2.5.0.tgz npm ERR! 403 In most cases, you or one of your dependencies are requesting npm ERR! 403 a package version that is forbidden by your security policy. npm ERR! 403 npm ERR! 403 It was specified as a dependency of ‘@antv/color-util’ npm ERR! 403 I tried to update nodejs and no change, remake the certs with mkcert and nothing, and make this npm config set strict-ssl false but do not work. ¿Any idea?

Best regards to all.

I tried to update nodejs and no change, remake the certs with mkcert and nothing, and make this npm config set strict-ssl false but do not work.

I expect that npm install and npm run build works.

Best regards.

Hi @jomaguca, welcome back. :wave:

Jenkins can’t find /usr/bin/node: This could be because Node.js is not installed on the machine where Jenkins is running, or it’s installed in a different location.

You can check if Node.js is installed and where it’s located by running which node in the terminal.
If it’s not installed, you’ll need to install it. If it’s installed in a different location, you can add that location to the PATH in Jenkins.
You’re getting a 403 Forbidden error when trying to install a package with npm: This could be due to a few reasons, such as a misconfigured .npmrc file, a problem with your network settings, or a package that’s been deprecated or removed from the npm registry.

Check if Node.js is installed and where it’s located. If it’s not installed, install it. If it’s installed in a different location, add that location to the PATH in Jenkins.

# Check if Node.js is installed and where it's located
which node

# If Node.js is not installed, install it
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs

# If Node.js is installed in a different location, add that location to the PATH in Jenkins
# Replace /path/to/node with the actual path to Node.js
echo "export PATH=\$PATH:/path/to/node" >> ~/.bashrc
source ~/.bashrc

Check your .npmrc file for any misconfiguration.
The .npmrc file is usually located in your home directory. If you see any lines related to registry.npmjs.org, try commenting them out by adding a # at the beginning of the line.

# Open the .npmrc file in a text editor
nano ~/.npmrc

# Comment out any lines related to registry.npmjs.org
# registry.npmjs.org=...

Try running npm install with the --verbose flag to get more detailed output. This might give you more information about what’s causing the error.
npm install --verbose

If you’re still getting the 403 Forbidden error, it might be a problem with your network settings. You can try using a different network or configuring npm to use a proxy.

# Configure npm to use a proxy
# Replace http://proxy-server.com:8080 with the actual proxy server and port
npm config set proxy http://proxy-server.com:3128
npm config set https-proxy http://proxy-server.com:3128

Hello Mr Poddingue nice to speak with you again… I have been ill but now I am ok.

Well, when I put “which npm” the result is
root@73c4a61b60d6:/certs# which node
/usr/bin/node
root@73c4a61b60d6:/certs# nano /usr/etc/npmrc
root@73c4a61b60d6:/certs# which npm
/usr/bin/npm
root@73c4a61b60d6:/certs#
I do it in the docker container who has jenkins.
I put the proxy setting and nothing.
the version of node and npm is
root@73c4a61b60d6:/certs# node --version
v18.19.0
root@73c4a61b60d6:/certs# npm --version
10.4.0
root@73c4a61b60d6:/certs#
The generation of war in the part od the server with maven was perfect so nodejs is the bad boy.

Best regards.
Thanks a lot.

1 Like

Hello again
I could execute npm install in command line as root but I can´t do it in jenkins because the execution is made by jenkins and not root so ¿How can I do it?

Best regards.

Are you doing a global install?

Hello Mr poddingue

Yes my installation is global, I am using nvm to do it, it is very strage beacuse I have to use docker app but this is it.
Now my only error is the next… npm ERR! 403 403 Forbidden - GET https://registry.npmjs.org/update-browserslist-db
Have you got any idea?

Best regards. Thanks a lot.

1 Like