typings
typings copied to clipboard
EACCES error when using typings as a different user
This might be npm issue, or dependency issue.
Setup is:
- Node installed as a root / global
- Project cloned as a www-data user
- typings installed globally
sudo npm install typings -g
- local .npmrc with settings
cache = "./.npm"
- all commands must be run as
www-data
When I run sudo -u www-data typings install
I get error:
Error: EACCES: permission denied, open '/home/tomas/.config/configstore/insight-typings.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:584:18)
at Object.fs.readFileSync (fs.js:431:33)
at Object.create.all.get (/usr/lib/node_modules/typings/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/lib/node_modules/typings/node_modules/configstore/index.js:27:44)
at new Insight (/usr/lib/node_modules/typings/node_modules/insight/lib/index.js:37:34)
at Object.<anonymous> (/usr/lib/node_modules/typings/dist/utils/insight.js:6:19)
at Module._compile (module.js:413:34)
at Object.Module._extensions..js (module.js:422:10)
at Module.load (module.js:357:32)
so even though I am running it as a www-data
user, it still goes into my current user home directory for some config.
I tried to disable insights --no-insights
and also tried --no-update-notifier
but had no effect
Any ideas?
I'll be killing insights with the next release, until then, no - sorry! However, it sounds like this issue will continue with update notifier, so perhaps you could ask in configstore
? I saw https://github.com/yeoman/configstore/issues/34, which is probably relevant to you.
Insight has been removed, but we still use configstore
. Is this still an issue for you?
yes, still getting configstore issue
This doesn't really address your issue, but have you tried setting up node / npm to avoid sudo
altogether? Eliminates some of these tricky permissions issues. John Papa wrote a great tutorial on this as a starting point: http://www.johnpapa.net/how-to-use-npm-global-without-sudo-on-osx/ (assumes OSX, if you are on Linux you'll have to adjust accordingly).
@SonofNun15 of course if I setup npm without sudo then all works, but the point is, the setup has to be with sudo/has to be available for every user on the system AND the main problem is that if I use the npm command as a different user: sudo -u www-data npm install
some packages are still trying to write into different user's home folder
That makes sense. :+1:
The root cause of this issue (and many like it) is https://github.com/npm/write-file-atomic/issues/11.
There is an outstanding patch which will fix this for everyone. We're all waiting for someone from npm to accept it: https://github.com/npm/write-file-atomic/pull/13