Tags

,

Problem:

I cannot install a semantic-ui using npm. When I encounter an error like this usually the solution is using a sudo command. Please don’t ever use npm with sudo (eg: sudo npm install semantic-ui) because it will make a headache for you.

artheman@ub3c:/var/www/_php/ci-blog(master)$ npm install semantic-ui

npm WARN deprecated gulp-clean-css@2.4.0: breaking changes from clean-css 4.x. Please install gulp-clean-css 3.x
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm ERR! Linux 3.19.0-82-generic
npm ERR! argv "/home/artheman/.nvm/versions/node/v6.2.2/bin/node" "/home/artheman/.nvm/versions/node/v6.2.2/bin/npm" "install" "semantic-ui"
npm ERR! node v6.2.2
npm ERR! npm  v3.9.5
npm ERR! path /home/artheman/.npm/event-stream/3.0.20
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/home/artheman/.npm/event-stream/3.0.20'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, mkdir '/home/artheman/.npm/event-stream/3.0.20'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/home/artheman/.npm/event-stream/3.0.20',
npm ERR!   parent: 'gulp-prompt' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/_php/ci-blog/npm-debug.log

Solution:
We just reclaim the ownership like this..
sudo chown -R $(whoami) ~/.npm

And thats it..

Advertisements