LinusU / node-appdmg

💾 Generate your app dmgs
MIT License
1.68k stars 152 forks source link

npm install fails #170

Closed toptensoftware closed 5 years ago

toptensoftware commented 5 years ago

Hi,

Trying to install appdmg, and getting the following errors:

Brads-MBP:~ brad$ sudo npm install -g appdmg
npm WARN deprecated cross-spawn-async@2.2.5: cross-spawn no longer requires a build toolchain, use it instead
/usr/local/bin/appdmg -> /usr/local/lib/node_modules/appdmg/bin/appdmg.js

> macos-alias@0.2.11 install /usr/local/lib/node_modules/appdmg/node_modules/macos-alias
> node-gyp rebuild

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/brad/.node-gyp/10.14.0"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/appdmg/node_modules/macos-alias/.node-gyp"
gyp WARN install got an error, rolling back install
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/appdmg/node_modules/macos-alias/.node-gyp'
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/local/lib/node_modules/appdmg/node_modules/macos-alias
gyp ERR! node -v v10.14.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! macos-alias@0.2.11 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the macos-alias@0.2.11 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/brad/.npm/_logs/2018-11-28T05_54_16_362Z-debug.log

Log file attached:

2018-11-28T05_54_16_362Z-debug.log

Any help greatly appreciated!

LinusU commented 5 years ago

EACCES user "root" does not have permission to access the dev dir "/Users/brad/.node-gyp/10.14.0"

It's inadvisable to use sudo together with npm on macOS. How did you install Node.js?

If it's an option for you, I would recommend to nuke your Node.js installation and install it using brew. Then never using sudo together with npm or node.

Since this isn't a problem specific to appdmg, I haven't got too much more insight. I would recommend opening an issue with npm, node or possibly node-gyp instead. Happy hacking!