Error upgrading to 3.7 on Mac (windows was fine)

I have tried uninstalling and installing from scratch but still get the same error.

when running the command npm install -g ionic@latest

I get the following error
test-MacBook-Air:cryptocal test$ sudo npm install -g ionic@latest
/usr/local/bin/ionic -> /usr/local/lib/node_modules/ionic/bin/ionic

fsevents@1.1.2 install /usr/local/lib/node_modules/ionic/node_modules/fsevents
node install

node-pre-gyp ERR! Tried to download(undefined):
node-pre-gyp ERR! Pre-built binaries not found for fsevents@1.1.2 and node@7.9.0 (node-v51 ABI) (falling back to source compile with node-gyp)
gyp ERR! clean error
gyp ERR! stack Error: EACCES: permission denied, rmdir 'build’
gyp ERR! System Darwin 16.5.0
gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js” "clean"
gyp ERR! cwd /usr/local/lib/node_modules/ionic/node_modules/fsevents
gyp ERR! node -v v7.9.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute ‘/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean’ (1)
node-pre-gyp ERR! stack at ChildProcess. (/usr/local/lib/node_modules/ionic/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:194:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:899:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Darwin 16.5.0
node-pre-gyp ERR! command “/usr/local/bin/node” “/usr/local/lib/node_modules/ionic/node_modules/fsevents/node_modules/.bin/node-pre-gyp” “install” "–fallback-to-build"
node-pre-gyp ERR! cwd /usr/local/lib/node_modules/ionic/node_modules/fsevents
node-pre-gyp ERR! node -v v7.9.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.36
node-pre-gyp ERR! not ok
Failed to execute ‘/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js clean’ (1)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/ionic/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 install: node install

Your problem is probably with npm, something to do with permissions and files. This happens quite often and is almost impossible to successfully debug (at least here in the forum).

One solution: Uninstall your node, install nvm (or nvm-windows if you are on Windows), install a new node (which includes npm) with this, then install ionic and cordova again and try your command again. The problem should be gone.

And also don’t use sudo with Ionic. It usually winds up causing issues.

1 Like

Hi, zoinky today I am also got this error.But I found solution.