ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

`sudo npm install -g ionic` errors

Open jacksonkr opened this issue 9 years ago • 6 comments

Ionic version: (check one with "x") [ ] 1.x [x] 2.x

I'm submitting a ... (check one with "x") [x] bug report [ ] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

$ sudo npm install -g ionic
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: use uuid module instead
npm WARN deprecated [email protected]: use uuid module instead
/usr/local/lib
└── (empty)

npm WARN In [email protected] replacing bundled version of cross-spawn with [email protected]
npm WARN In [email protected] replacing bundled version of semver with [email protected]
npm WARN In [email protected] replacing bundled version of mime-types with [email protected]
npm WARN In [email protected] replacing bundled version of form-data with [email protected]
npm WARN In [email protected] replacing bundled version of request with [email protected]
npm WARN In [email protected] replacing bundled version of ionic-app-lib with [email protected]
npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/Cellar/node/7.1.0/bin/node" "/usr/local/bin/npm" "install" "-g" "ionic"
npm ERR! node v7.1.0
npm ERR! npm  v3.10.9
npm ERR! path /usr/local/lib/node_modules/.staging/ansi-392b32ed
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/.staging/ansi-392b32ed' -> '/usr/local/lib/node_modules/ionic/node_modules/cordova-lib/node_modules/ansi'
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/ansi-392b32ed' -> '/usr/local/lib/node_modules/ionic/node_modules/cordova-lib/node_modules/ansi'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Jackson/Sites/ratl/npm-debug.log
npm ERR! code 1
lapfeet:ratl Jackson$ ionic
-bash: ionic: command not found

Expected behavior:

clean install

Steps to reproduce:

Related code:

sudo npm install -g ionic

Other information:

Everything was working before trying to update, including ionic. Also, I didn't want to run this as sudo but I kept getting permission denied errors.

I'm finding out that there is no "/usr/local/lib/node_modules/.staging" folder

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

N/A

jacksonkr avatar Jan 02 '17 19:01 jacksonkr

This resolved with

$  sudo chmod -R 777 /usr/local/lib
$  brew postinstall node

Also, you may need to do these steps beforehand

$ sudo brew uninstall -g npm
$ sudo brew uninstall -g node
$ brew install -g node
$ brew install -g npm 

jacksonkr avatar Jan 02 '17 20:01 jacksonkr

Same error here on windows 10.

npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Sierran\AppData\Roaming\npm\node_modules\.staging\ansi-cf228dbe' -> 'C:\Users\Sierran\AppData\Roaming\npm\node_modules\ionic\node_modules\cordova-lib\node_modules\ansi'
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Sierran\AppData\Roaming\npm\node_modules\.staging\ansi-cf228dbe' -> 'C:\Users\Sierran\AppData\Roaming\npm\node_modules\ionic\node_modules\cordova-lib\node_modules\ansi'
node -v
v6.9.1
npm -v
3.10.8

ksampolski avatar Jan 02 '17 20:01 ksampolski

@sierran It appears to be a permissions issue. I'm not sure how to redo the permissions for windows 10 but I suggest taking C:\Users\Sierran\AppData\Roaming\npm and making it and all subdirectories writeable by all users. Then try again.

jacksonkr avatar Jan 02 '17 21:01 jacksonkr

@jacksonkr i just deleted ionic from %appdata% and reinstall it. Now work perfectly ;)

ksampolski avatar Jan 02 '17 21:01 ksampolski

I updated node and npm. Then I installed cordova (using npm). After that, I used what @jacksonkr suggested:

$ sudo chmod -R 777 /usr/local/lib $ brew postinstall node

It worked fine! I'm using a Mac.

Thank you, @jacksonkr :)

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

ionitron-bot[bot] avatar Sep 04 '18 00:09 ionitron-bot[bot]