EACCES error while running npm install in jenkins pipeline ... OS: darwin - node.js

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /.npm
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1001:1001 "/.
How to resolve this, this is a organization server?
Edit: The $whoami is already the owner of all npm related files and folders

Related

eacces error whlle running npm install -g composer-cli

npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /home/akash2/.npm-packages/lib/node_modules/.staging/grpc-b403b8a1/node_modules/mkdirp
npm ERR! dest /home/akash2/.npm-packages/lib/node_modules/.staging/mkdirp-13f83417
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1000:1000 "/home/akash2/.npm"
npm ERR! A complete log of this run can be found in:
npm ERR! /home/akash2/.npm/_logs/2021-05-07T05_37_52_411Z-debug.log
These are the errors. I am trying to fix this, but can't.

How to resolve npm issue

I'm trying to install npm version 6.9.0 using command npm install --global npm#6.9.0
And I'm getting following error
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /root/.npm-global/lib/node_modules/.staging/npm-0fd8a334/node_modules/yargs
npm ERR! dest /root/.npm-global/lib/node_modules/.staging/yargs-71bc3a6a
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 0:0 "/root/.npm"
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-12-01T10_31_32_191Z-debug.log
I've tried sudo chown -R 0:0 "/root/.npm" cleaning npm cache but nothing works.
I'm using ubuntu 20.04 (WSL) How to resolve this?
Do sudo npm install --global npm#6.9.0

Trying to install npm on Raspberry Pi Error

I am working on a simple smart mirror project with javascript and electron. I was able to get the software working on my laptop but when I moved it to the raspberry pi I am having issues installing npm. After entering "npm install" I get this:
npm WARN package.json bcrypt-pbkdf#1.0.1 No repository field.
npm ERR! 404 Not Found
npm ERR! 404
npm ERR! 404 'types/jquery' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 It was specified as a dependency of 'smart-mirror-server'
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.
npm ERR! System Linux 4.9.24-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/pi/Desktop/smart-connected-mirror-master
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! code E404
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/pi/Desktop/smart-connected-mirror-master/npm-debug.log
npm ERR! not ok code 0
I have tried
sudo apt-get update
as well as
sudo apt-get upgrade
Any ideas what to do? Thanks!
EDIT:
I updated the node.js to a more current version and now it installed without error. However, when I typed in the command
npm start
I get this:
sh: 1: electron: Permission denied
npm ERR! Linux 4.9.24-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v7.10.0
npm ERR! npm v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! smart-mirror-server#1.0.0 start: `electron .`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the smart-mirror-server#1.0.0 start script 'electron .'.
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 smart-mirror- server package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! electron .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs smart-mirror-server
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls smart-mirror-server
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/.npm/_logs/2017-05-29T03_33_22_466Z-debug.log
Have you seen this issue? Electron works only on RaspberryPi 2/3 what version are you using?
Also have you run npm install before actually run the app? Sometimes when copying node_modules from OS to OS the executable permissions get very confused.
You can try a fresh install with: rm -rf node_modules && npm install

npm install fails because of chown

I have installed npm locally in ~/.local
Now, I want to install grunt-cli globally in this local install, but I have this output :
npm ERR! Linux 3.19.0-18-generic
npm ERR! argv "/home/etud/(my name)/.local/usr/bin/node" "/home/etud/(my name)/.local/bin/npm" "install" "-g" "grunt-cli"
npm ERR! node v4.1.1
npm ERR! npm v2.14.4
npm ERR! path /home/etud/(my name)/.npm/grunt-cli/0.1.13/package/package.json.ee5c5aa03b9d2c7367d767e1d6e17af3
npm ERR! code Unknown system error -121
npm ERR! errno -121
npm ERR! syscall chown
npm ERR! Unknown system error -121: Unknown system error -121, chown '/home/etud/(my name)/.npm/grunt-cli/0.1.13/package/package.json.ee5c5aa03b9d2c7367d767e1d6e17af3'
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! /home/etud/(my name)/npm-debug.log
I've done :
$> npm config set -g user=`whoami`
and put this into ~/.npmrc :
root = /home/(my name)/.local/lib/node_modules
binroot = /home/(my name)/.local/bin
manroot = /home/(my name).local/share/man
Any idea ?
EDIT
I'm on my university machine that are working on nfs systems. It seems I can't call the chown command because of problem of user map.
Is there a way to make npm skip any chown ?

Why do i have to call npm link as administrator?

I installed some nodejs packages globally via
sudo npm install gulp -g
Now I (or another developer on the same machine) wants to use it in a project with
me#host:/my/project$ npm link gulp
It fails with
unbuild gulp#3.8.11
npm ERR! Error: EPERM, chmod '/my/projectnode_modules/gulp/bin/gulp.js'
npm ERR! { [Error: EPERM, chmod '/my/projectnode_modules/gulp/bin/gulp.js']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path: '/my/projectnode_modules/gulp/bin/gulp.js' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.2.0-4-amd64
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "link" "gulp"
npm ERR! cwd /raid5/workspaces/jgr/aktivglueck-laravel
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! path /my/projectnode_modules/gulp/bin/gulp.js
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, chmod '/my/projectnode_modules/gulp/bin/gulp.js'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /my/projectnpm-debug.log
npm ERR! not ok code 0
With
sudo npm link gulp
everything works fine.
What I want to know is: Why does npm link need admin permissions? In my understanding I am creating a link inside my project folder where I have full permissions - so what does it do on the global system?
I believe npm link creates a symlink to the current directory in wherever your globally installed node packages are. See here.
If you don't have write rights to that path (you can check with npm config get prefix) you'll get the error you see there.
To avoid having to sudo global installs/links, you could change the ownership/rights of that directory.

Resources