JavaScript

uninstall npm packages globally

Hi, I am unable to uninstall node, sass, npm which i install globally. Also need help in figuring out which package can be global and which are project specific.

Jayaramans-MacBook-Pro:/ jayaramanthiyyadi$ npm -v
5.5.1
Jayaramans-MacBook-Pro:/ jayaramanthiyyadi$ node -v
v8.9.1
Jayaramans-MacBook-Pro:/ jayaramanthiyyadi$ sass -v
Sass 3.5.3 (Bleeding Edge)
Jayaramans-MacBook-Pro:/ jayaramanthiyyadi$ npm uninstall sass
npm WARN saveError ENOENT: no such file or directory, open '/package.json'
npm WARN saveError EACCES: permission denied, open '/package-lock.json.1286701303'
npm WARN enoent ENOENT: no such file or directory, open '/package.json'
npm WARN !invalid#2 No description
npm WARN !invalid#2 No repository field.
npm WARN !invalid#2 No README data
npm WARN !invalid#2 No license field.

up to date in 0.046s
Jayaramans-MacBook-Pro:/ jayaramanthiyyadi$ npm uninstall sass -g
up to date in 0.043s
Jayaramans-MacBook-Pro:/ jayaramanthiyyadi$ npm uninstall node
npm WARN saveError ENOENT: no such file or directory, open '/package.json'
npm WARN saveError EACCES: permission denied, open '/package-lock.json.567584276'
npm WARN enoent ENOENT: no such file or directory, open '/package.json'
npm WARN !invalid#2 No description
npm WARN !invalid#2 No repository field.
npm WARN !invalid#2 No README data
npm WARN !invalid#2 No license field.

up to date in 0.046s
Jayaramans-MacBook-Pro:/ jayaramanthiyyadi$ npm uninstall node -g
up to date in 0.045s
Jayaramans-MacBook-Pro:/ jayaramanthiyyadi$ 

Note: planning on developing a simple dynamic site for learning purpose using html, css, sass, bootstrap, javascript, jquery for front end development and for backend I hope nodejs and mongo db.

1 Answer

Jordan Watson
MOD
Jordan Watson
Treehouse Moderator 14,737 Points

To uninstall NPM packages globally you need to ensure you have the global flag in in remove line i.e

npm uninstall -g <package>