Klathmon / imagemin-webpack-plugin

Plugin to compress images with imagemin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

npm install permission denied / requires root

veeeeeeeeeee opened this issue · comments

commented

Hi,
I'm getting an issue that is quite similar to this
#34
with a slightly different error message (permission denied for syscall mkdir instead of open)


npm ERR! path /home/viet/test/node_modules/.staging/imagemin-webpack-plugin-6bb12f01/dist
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/home/viet/test/node_modules/.staging/imagemin-webpack-plugin-6bb12f01/dist'
npm ERR!  { Error: EACCES: permission denied, mkdir '/home/viet/test/node_modules/.staging/imagemin-webpack-plugin-6bb12f01/dist'
npm ERR!   cause: 
npm ERR!    { Error: EACCES: permission denied, mkdir '/home/viet/test/node_modules/.staging/imagemin-webpack-plugin-6bb12f01/dist'
npm ERR!      errno: -13,
npm ERR!      code: 'EACCES',
npm ERR!      syscall: 'mkdir',
npm ERR!      path: '/home/viet/test/node_modules/.staging/imagemin-webpack-plugin-6bb12f01/dist' },
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/home/viet/test/node_modules/.staging/imagemin-webpack-plugin-6bb12f01/dist',
npm ERR!   parent: 'test' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/viet/.npm/_logs/2019-01-14T23_28_07_545Z-debug.log

Additional Info

OS: ubuntu 18.04
$ npm config get prefix
/home/viet/.nvm/versions/node/v8.1.2
$ npm -v
5.0.3

Again, i'm unable to reproduce this bug on my system. Ubuntu 18.10, same exact version of node and NPM installed via nvm. At this point I'm pretty sure this is an NPM problem and not a problem with my plugin, but I'm not 100% sure.

If you are willing, can you try installing all of the dependencies of this plugin one-at-a-time and see if any of them cause the issue for you?

"dependencies": {
    "async-throttle": "^1.1.0",
    "babel-runtime": "^6.18.0",
    "imagemin": "^6.1.0",
    "imagemin-gifsicle": "^6.0.1",
    "imagemin-jpegtran": "^6.0.0",
    "imagemin-optipng": "^6.0.0",
    "imagemin-pngquant": "^6.0.0",
    "imagemin-svgo": "^7.0.0",
    "lodash.map": "^4.6.0",
    "minimatch": "^3.0.4",
    "mkdirp": "^0.5.1",
    "util.promisify": "^1.0.0",
    "webpack-sources": "^1.1.0"
  },

Also, your version of npm is quite old, about 2 years old, and is no longer supported by npm. Upgrading to 5.10.0 will put you at the oldest currently supported version. Similarly for your version of node. v8.15.0 is the current latest of the v8 version which is still supported, and upgrading there may help if you are able to.

commented

Thanks @Klathmon
Changing node version v8.15.0 (npm 6.4.1) indeed fixed it.

The whole thing was very weird to me because I'm installing a local package and it fails on a mkdir within local node_modules. Meanwhile almost all EACCES people face with involve with writing to folders outside of current project (mostly npm install global).