I'm trying to install node on MacOS using the following command:
sudo npm install -g node
This yields the following output:
> node@12.6.0 preinstall /usr/local/lib/node_modules/node-darwin-x64/lib/node_modules/node-darwin-x64/lib/node_modules/node
> node installArchSpecificPackage
npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning EACCES: EACCES: permission denied, open '/Users/bernhard/.npm/_cacache/tmp/5e859640'
npm WARN registry Using stale data from https://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! path /Users/bernhard/.npm/_cacache/tmp/ef2c2113
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open '/Users/bernhard/.npm/_cacache/tmp/ef2c2113'
npm ERR! [OperationalError: EACCES: permission denied, open '/Users/bernhard/.npm/_cacache/tmp/ef2c2113'] {
npm ERR! cause: [Error: EACCES: permission denied, open '/Users/bernhard/.npm/_cacache/tmp/ef2c2113'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: '/Users/bernhard/.npm/_cacache/tmp/ef2c2113'
npm ERR! },
npm ERR! isOperational: true,
npm ERR! stack: "Error: EACCES: permission denied, open '/Users/bernhard/.npm/_cacache/tmp/ef2c2113'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: '/Users/bernhard/.npm/_cacache/tmp/ef2c2113'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
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 (though this is not recommended).
/usr/local/lib/node_modules/node-darwin-x64/lib/node_modules/node-darwin-x64/lib/node_modules/node/node_modules/node-bin-setup/index.js:27
throw e;
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/node-darwin-x64/lib/node_modules/node-darwin-x64/lib/node_modules/node/bin'
at Object.mkdirSync (fs.js:764:3)
at ChildProcess.<anonymous> (/usr/local/lib/node_modules/node-darwin-x64/lib/node_modules/node-darwin-x64/lib/node_modules/node/node_modules/node-bin-setup/index.js:24:10)
at ChildProcess.emit (events.js:203:13)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
errno: -13,
syscall: 'mkdir',
code: 'EACCES',
path: '/usr/local/lib/node_modules/node-darwin-x64/lib/node_modules/node-darwin-x64/lib/node_modules/node/bin'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node@12.6.0 preinstall: `node installArchSpecificPackage`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node@12.6.0 preinstall 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/bernhard/.npm/_logs/2019-07-21T16_20_19_759Z-debug.log
Running sudo npm cache clean
before-hand does not make a difference. I checked the permissions on the _cacache
folder and my user has full permissions to that folder.
Any ideas as to what may be causing this issue?