Reputation: 5002
I get this when I try to create a webapp with yeoman
.
/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:66
throw err;
^
Error: EACCES, permission denied '/root/.config/configstore/insight-yo.yml'
You don't have access to this file.
at Object.fs.openSync (fs.js:436:18)
at Object.fs.writeFileSync (fs.js:975:15)
at Object.create.all.set (/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:56:8)
at Object.Configstore (/usr/local/lib/node_modules/yo/node_modules/insight/node_modules/configstore/configstore.js:19:11)
at new Insight (/usr/local/lib/node_modules/yo/node_modules/insight/lib/insight.js:23:34)
at process.<anonymous> (/usr/local/lib/node_modules/yo/node_modules/insight/lib/push.js:11:16)
at process.emit (events.js:98:17)
at handleMessage (child_process.js:322:10)
at Pipe.channel.onread (child_process.js:349:11)
I googled and I tried the following things, but it didn't help:
chown root /root/.config/configstore/insight-yo.yml
chown myusername /root/.config/configstore/insight-yo.yml
Installed npm-sudo-fix
and ran it, and no luck yet.
I am on Debian Wheezy and have npm 1.4.4.
Upvotes: 4
Views: 8428
Reputation: 4482
I had the same issue building a meanjs app on Ubuntu and I've fixed this issue using sudo
instead of root
:
sudo npm install -g yo generator-meanjs bower grunt
Then i could build the app without being asked for password again:
yo meanjs
sudo allows user to act as root without root login, it is more secure to use sudo instead of logging in as root. sudo vs root - askubuntu
Upvotes: 1
Reputation: 41
the issue is that yo is not granted to use some of the nodejs modules. basically, y the problem is related to authorization of yo by node package manager "npm", to fix this run this command first
sudo npm install --global yo --allow-root
Upvotes: 0
Reputation: 339
I just fixed it in Windows. I have done three things, which one have fixed it I am not sure.
Run cmd prompt as administrator.
takeown /?
this command is equivalent to chown
(linux) but for windows.
cacls -cacls /E /T /G :F
simply go in $USER
/Users/calvin/.config/configstore/
and make files unhidden.
it worked for me like charm. I have been trying to fix this since many days.
Upvotes: 1
Reputation: 178
I was facing the same issue. I ran the command below, It fixed my problem:
mkdir -p /root/.config/configstore
chmod g+rwx /root /root/.config /root/.config/configstore
Upvotes: 11
Reputation: 15232
Although the chmod
command seemed to work at first, I got a similar error later, for a different folder. But here I found this workaround which fixed that too:
sed -i -e '/rootCheck/d' "${NPM_CONFIG_PREFIX}/lib/node_modules/yo/lib/cli.js"
If yo
is run as root, rootCheck
will downgrade to UID 1000 (on Linux) or 501 (on OS X). This causes the permission error. But in a docker container, you might want to run as root, so you have no other option.
You need to rerun this command after upgrading yeoman. In case NPM_CONFIG_PREFIX
is not defined, you can use:
export NPM_CONFIG_PREFIX=$(npm config get prefix)
Upvotes: 0
Reputation: 576
The same issue happened to me, i was in root mode user#. I just get back to normal user$ and it worked. i am using Zorin OS
Upvotes: 3
Reputation: 5002
I was able to fix this by running:
echo prefix = ~/.node >> ~/.npmrc
and
export PATH=$HOME/.node/bin:$PATH
Explanation here:
Error installing yeoman
What does `echo prefix = ~/.node >> ~/.npmrc` mean?
npm / yeoman install generator-angular without sudo
Upvotes: 1