npm config permission error - javascript

I am having permission problems with the npm config command. It seems that for some reason it is trying to change the owner of my ~/.npmrc file. When running npm config set color false, I get the following error:
npm ERR! Error: EPERM, chown '/home/bamboo/.npmrc'
npm ERR! { [Error: EPERM, chown '/home/bamboo/.npmrc'] errno: 50, code: 'EPERM', path: '/home/bamboo/.npmrc' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.13.0-32-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "config" "set" "color" "false"
npm ERR! cwd /home/bamboo
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path /home/bamboo/.npmrc
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, chown '/home/bamboo/.npmrc'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/bamboo/npm-debug.log
npm ERR! not ok code 0
The file .npmrc has the right permissions and I can edit it manually but I need to do it from the npm config command since it is part of an automated build. I can't seem to find valuable information on that matter. I set the prefix to a directory I own and can install globally without any problem but can't run configure! I am running Ubuntu 14.04.
Does anybody have some ideas?

I had the same problem.
https://github.com/npm/npm/issues/7563
Turns out changing from sudo su to sudo su - when starting the bamboo agent process solved the problem.

Got this problem once.
The .npm directory does not have sufficient permissions. Run the following command:
sudo chown -R $(whoami) ~/.npm

Related

Can't install expo-cli -g

I'm new in react-native, I'm trying to set up my project after all package install when I tried to start npm start command then show me 'expo-cli' is not recognized as an internal or external command, this error.
ok, then I have followed the guide from here
after that I have added my env path in this way:
environment variable > System Variables > PATH >
C:\Users\YOUR_USERNAME\AppData\Roaming\npm
then I have to install again:
npm install -g expo-cli
but it does not work for me, I don't know why.
when I try to run this command npm install -g expo-cli then show me an error like this:
PS C:\Users\alami\OneDrive\Desktop\React native\starter-react-native> npm install -g expo-cli
npm ERR! code EPERM
npm ERR! syscall mkdir
npm ERR! path C:\Program Files\nodejs\node_modules\expo-cli
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\expo-cli'
npm ERR! [Error: EPERM: operation not permitted, mkdir 'C:\Program Files\nodejs\node_modules\expo-cli'] {
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'mkdir',
npm ERR! path: 'C:\\Program Files\\nodejs\\node_modules\\expo-cli'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\alami\AppData\Local\npm-cache\_logs\2021-05-21T00_58_34_585Z-debug.log
At least I just solved my problem in this way:
Search cmd
Then run as administrator
Then npm i -g expo-cli
I just solved my problem.

Node.js- "npm install express" error:0906D06C :PEM routines : PEM_read_bio npm

I have installed node.js and it has npm installed along with it. In my windows command prompt,when i write "npm install express", it gives me the following error.How to resolve this?
C:\Users>npm -v
2.11.2
C:\Users>npm install express
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\\node.exe" "C:\Program
Files\nodejs \node_modules\npm\bin\npm-cli.js" "install"
"express"
npm ERR! node v0.12.5
npm ERR! npm v2.11.2
npm ERR! error:0906D06C:PEM routines:PEM_read_bio:no start line
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! C:\Users\npm-debug.log
I also got same problem after setting registry problem got resolved.
cmd>> npm set registry registry.npmjs.org
cmd>> npm install
it worked for me.

Yeoman Javascript error involving 'mkdir'

I'm setting up a Meanjs instance with a Yeoman generator. When I do 'sudo yo meanjs' everything works fine until it looks like it is trying to make a directory and it fails, any ideas on what is going on here?
SOLINK_MODULE(target) Release/kerberos.node: Finished
> bson#0.2.5 install /Users/xxx/Documents/mean/node_modules/connect-
mongo/node_modules/mongodb/node_modules/bson
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bson/ext/bson.o
SOLINK_MODULE(target) Release/bson.node
SOLINK_MODULE(target) Release/bson.node: Finished
npm ERR! Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15'
npm ERR! { [Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/Users/xxx/.npm/uglify-js/2.4.15',
npm ERR! parent: 'grunt-contrib-uglify' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/xxx/Documents/mean
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.4.28
npm ERR! path /Users/xxx/.npm/uglify-js/2.4.15
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/Users/xxx/.npm/uglify-js/2.4.15'
npm ERR! not ok code 0
That is a pretty common error.
Yeoman is running the following:
bower install & npm install
Bower install succeeded, however NPM install is failing because of user permissions. Just run:
sudo npm install
The ZenCoder's answer is spot on, but if you want to permanently fix this permissions error, you can follow the tutorial at: https://docs.npmjs.com/getting-started/fixing-npm-permissions
Since you're on a Mac, you could actually avoid npm permissions errors altogether by just installing node instead via homebrew:
brew install node (this will install npm too)
Homebrew installs programs to a directory that doesn't require sudo for write, so you can npm install -g <whatever> freely without it.

TypeError: Request path contains unescaped characters

I try to install node.js modules using:
npm install express
but I get this error:
npm http GET https://registry.npmjs.org/express
npm ERR! TypeError: Request path contains unescaped characters.
npm ERR! at Agent.request (_http_agent.js:264:11)
npm ERR! at TunnelingAgent.exports.request (http.js:52:22)
npm ERR! at TunnelingAgent.createSocket (/usr/local/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:117:25)
npm ERR! at TunnelingAgent.createSecureSocket [as createSocket] (/usr/local/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:184:41)
npm ERR! at TunnelingAgent.addRequest (/usr/local/lib/node_modules/npm/node_modules/request/node_modules/tunnel-agent/index.js:80:8)
npm ERR! at new ClientRequest (_http_client.js:112:16)
npm ERR! at Agent.request (_http_agent.js:279:10)
npm ERR! at Object.exports.request (https.js:130:22)
npm ERR! at Request.start (/usr/local/lib/node_modules/npm/node_modules/request/index.js:594:30)
npm ERR! at Request.end (/usr/local/lib/node_modules/npm/node_modules/request/index.js:1186:28)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 3.6.11-7.fc16.x86_64
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "express"
npm ERR! cwd /usr/local/src/node
npm ERR! node -v v0.11.5-pre
npm ERR! npm -v 1.3.5
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /usr/local/src/node/npm-debug.log
npm ERR! not ok code 0
May be happening I use a proxy I set it up this way to allow downloads from ips outside my network
export https_proxy='http://172.21.0.12:3128'
I hope you can help me
Set proxy from commandline.
npm config set proxy http://proxydomain:port/
If error occur yet, additional try next.
npm config set registry http://registry.npmjs.org/
These work for me.
(ref http://sushichop.blogspot.jp/2013/01/npm-install.html)
Though late enough, I've bumped into this too after updating nodejs (to 4.1.1) and npm (to something like 1.4.x) on Linux.
I've tried the suggested solution, but changing the registry entry did not help in all cases.
Lastly, having decided to reinstall npm, I found this update source [on npm github][1]
curl -L https://www.npmjs.org/install.sh | sh
which updated my npm to 3.3.8 and all related package installation troubles have been blown away.

Needed assistance in installing http-proxy module in node.js

I am trying to install http-proxy on Node, so I can set up a HTTPS proxy, but am running with the following error. Any suggestions as to how I can get http-proxy or any other suggestions how I can set up a HTTPS proxy using node.js. Thanks in advance
npm install http-proxy
npm http GET https://registry.npmjs.org/http-proxy
npm http 304 https://registry.npmjs.org/http-proxy
npm ERR! Error: ENOTDIR, mkdir '/Users/rshroff/tmp/npm-15272/1351528387771-0.3611239262390882'
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Darwin 11.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "http-proxy"
npm ERR! cwd /Users/rshroff
npm ERR! node -v v0.8.10
npm ERR! npm -v 1.1.65
npm ERR! path /Users/rshroff/tmp/npm-15272/1351528387771-0.3611239262390882
npm ERR! code ENOTDIR
npm ERR! errno 27
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/rshroff/npm-debug.log
npm ERR! not ok code 0
Yaa, so issues here was that my tmp directory did not write permission. Sorry for asking such a silly question.

Categories

Resources