0

So i'm installing node, npm and cordova+ionic on my mac (High Sierra) and it's giving me this issue:

Julime-Air:~ julime$ brew install node
==> Downloading https://homebrew.bintray.com/bottles/node-9.3.0_1.high_sierra.bottle.tar.gz
Already downloaded: /Users/julime/Library/Caches/Homebrew/node-9.3.0_1.high_sierra.bottle.tar.gz
==> Pouring node-9.3.0_1.high_sierra.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
  /usr/local/Cellar/node/9.3.0_1: 5,125 files, 49.6MB
Julime-Air:~ julime$ npm install npm@latest -g
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
+ npm@5.6.0
updated 1 package in 16.966s
Julime-Air:~ julime$ npm -v
5.6.0
Julime-Air:~ julime$ npm install -g cordova ionic
npm WARN deprecated node-uuid@1.4.8: Use uuid module instead
npm ERR! path /usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/ansistyles
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/ansistyles' -> '/usr/local/lib/node_modules/cordova/node_modules/npm/node_modules/.ansistyles.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/julime/.npm/_logs/2017-12-15T22_50_54_958Z-debug.log

tried reinstalling but no luck

Edit: Running as sudo does not help.

Edit2: Installing Node via mac installer does also not help.

Julime
  • 3,050
  • 2
  • 11
  • 21
  • Possible duplicate of [npm install ghost fails with code EPERM errno -4048 syscall rename (on Windows)](https://stackoverflow.com/questions/36677801/npm-install-ghost-fails-with-code-eperm-errno-4048-syscall-rename-on-windows) – tech4him Dec 15 '17 at 23:06
  • @tech4him this does not seem to be the same error nor is that fix from op relevant for me. Downgrading npm for perfoming any install is also not an option. – Julime Dec 15 '17 at 23:17

1 Answers1

1

After having some trouble removing that mac-installer-node, i think this fixed my problem:

sudo chown -R $USER /usr/local
brew doctor
brew link --overwrite node

If you had the same issue, please comment if this helped.

Julime
  • 3,050
  • 2
  • 11
  • 21
  • 1
    I would not advise overriding permissions for `/usr/local` directory @Zanna did a great job explaining it in answer to [askubuntu question](https://askubuntu.com/questions/261326/is-it-safe-to-chown-usr-local) which is UNIX system as well so similar rules apply to macOS as well. – G07cha Dec 16 '17 at 14:38