tcoopman / image-webpack-loader

Image loader module for webpack
MIT License
2.03k stars 132 forks source link

[Solved] NPM Install Error: EACCES: permission denied cwebp-bin/vendor; cwebp pre-build #122

Open ghost opened 7 years ago

ghost commented 7 years ago

Hi I got this error NPM Install Error "EACCES: permission denied, mkdir '/mnt/hdd2p7/0Programming/Webpack/js_modules/node_modules/cwebp-bin/vendor' when I was trying to install image-webpack-loader in the project directory

I have NodeJS 8.5.0 and npm 5.4.2. This kind of npm install error has happened to me many times ... one time when I was doing an online course recently, and another time when I was following a tutorial on YouTube... How can I avoid such??? Is this due to version conflict or what??? Please help. Thank you.

$ sudo npm install --save-dev image-webpack-loader

cwebp-bin@3.2.0 postinstall /mnt/hdd2p7/0Programming/Webpack/js_modules/node_modules/cwebp-bin node lib/install.js

⚠ EACCES: permission denied, mkdir '/mnt/hdd2p7/0Programming/Webpack/js_modules/node_modules/cwebp-bin/vendor' ⚠ cwebp pre-build test failed ℹ compiling from source /mnt/hdd2p7/0Programming/Webpack/js_modules/node_modules/onetime/index.js:15 throw new Error(fnName + ' can only be called once.'); ^

Error: callback() can only be called once. at onetime (/mnt/hdd2p7/0Programming/Webpack/js_modules/node_modules/onetime/index.js:15:11) at /mnt/hdd2p7/0Programming/Webpack/js_modules/node_modules/download/index.js:156:5 at ConcatStream. (/mnt/hdd2p7/0Programming/Webpack/js_modules/node_modules/concat-stream/index.js:36:43) at emitNone (events.js:110:20) at ConcatStream.emit (events.js:207:7) at finishMaybe (/mnt/hdd2p7/0Programming/Webpack/js_modules/node_modules/readable-stream/lib/_stream_writable.js:607:14) at endWritable (/mnt/hdd2p7/0Programming/Webpack/js_modules/node_modules/readable-stream/lib/_stream_writable.js:615:3) at ConcatStream.Writable.end (/mnt/hdd2p7/0Programming/Webpack/js_modules/node_modules/readable-stream/lib/_stream_writable.js:571:41) at DuplexWrapper.onend (/mnt/hdd2p7/0Programming/Webpack/js_modules/node_modules/readable-stream/lib/_stream_readable.js:570:10) at Object.onceWrapper (events.js:314:30) npm WARN babel-loader@7.1.2 requires a peer of webpack@2 || 3 but none is installed. You must install peer dependencies yourself. npm WARN js_modules@1.0.0 No description npm WARN js_modules@1.0.0 No repository field. npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.2 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! cwebp-bin@3.2.0 postinstall: node lib/install.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the cwebp-bin@3.2.0 postinstall script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /home/user1/.npm/_logs/2017-10-13T12_52_24_243Z-debug.log

ghost commented 7 years ago

It seems that NPM is not a very good package manager. After using yarn to install the missing package image-webpack-loader, it worked! So whenever npm tells you some module is missing, just install it via yarn:

to install yarn: $ sudo curl -o- -L https://yarnpkg.com/install.sh | bash

Migrating from npm | Yarn https://yarnpkg.com/lang/en/docs/migrating-from-npm/ npm install --save-dev [package] => yarn add [package] [--dev/-D] then install the failed or missing package: $ sudo yarn add image-webpack-loader --dev/-D $ sudo yarn add file-loader --dev/-D

dvargas92495 commented 6 years ago

any update on this issue on how to get it to work with npm? node 8.9.0 and npm 5.6.0