embark
embark copied to clipboard
Cannot install npm
Bug Report
Install fails:
sudo npm install -g embark
From the attached log:
40326 verbose stack Error: [email protected] preinstall: `node node-scrypt-preinstall.js`
40326 verbose stack Exit status 1
40326 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
40326 verbose stack at EventEmitter.emit (events.js:197:13)
40326 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
40326 verbose stack at ChildProcess.emit (events.js:197:13)
40326 verbose stack at maybeClose (internal/child_process.js:984:16)
40326 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
How to reproduce
Install latest node, execute the command
OS: Mac Darwin Kernel Version 16.7.0 node: v11.10.0 npm: 6.9.0
Actually I just checked and latest node is 12.4.0 after installing that there is a similar but slightly different error:
> [email protected] preinstall /usr/local/lib/node_modules/embark/node_modules/scrypt
> node node-scrypt-preinstall.js
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
internal/process/main_thread_only.js:42
cachedCwd = binding.cwd();
^
Error: EACCES: permission denied, uv_cwd
at process.cwd (internal/process/main_thread_only.js:42:25)
at Object.resolve (path.js:976:47)
at patchProcessObject (internal/bootstrap/pre_execution.js:73:28)
at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:10:3)
at internal/main/run_main_module.js:7:1 {
errno: -13,
code: 'EACCES',
syscall: 'uv_cwd'
}
Command is run as sudo, so don't really get the error.
Hi there,
this sounds like it's similar to https://github.com/embark-framework/embark/issues/1646. Can you try with a 10.x version of node?
I came across same issue, but it appears to be an error caused by trying to install node-gyp
with sudo permissions, running same command without sudo I got a permissions denied issue on the folders:
- /usr/local/bin/embark
- /usr/local/lib/node_modules
So my approach in order to install embark globally make it work I got to set right permissions over those forder using the following commands:
sudo setfacl -dR -m u:$(whoami):rwX /usr/local/lib/node_modules
sudo setfacl -R -m u:$(whoami):rwX /usr/local/lib/node_modules
sudo setfacl -dR -m u:$(whoami):rwX /usr/local/bin/
sudo setfacl -R -m u:$(whoami):rwX /usr/local/bin
Hopefully it is useful for someone else, although on github this github issue it said that it works also doing the following and running it with sudo
:
npm config set user 0
npm config set unsafe-perm true