Weird behaviour on my OSX Yosemite: from one day to another all my node modules installed by npm install -g
were not found via the Terminal.
I'm not sure if this is due to my node v4.0.0 install the day before.
Install it globally
npm i -g webpack
If you will work with webpack, install webpack-dev-server too
npm i -g webpack-dev-server
After I Install this two command I also found errors when run the
webpack
command so I figure out the problem by changing the version of webpack so I Install
npm install [email protected]
and every thing work fine for me.
I recommend you first learn a bit about npm and then webpack. You will struggle a lot. but finally you will find the right destination.
Webpack is in your ./node_modules/.bin/ folder so instead of giving just webpack as the command try this.
./node_modules/.bin/webpack
You have the npm bin command to get the folder where npm will install executables.
You can use the scripts property of your package.json to use webpack from this directory which will be exported.
"scripts": { "scriptName": "webpack --config etc..." } For example:
"scripts": { "build": "webpack --config webpack.config.js" } You can
then run it with:
npm run build
Or even with arguments:
npm run build -- <args>
This allow you to have you webpack.config.js in the root folder of your project without having webpack globally installed or having your webpack configuration in the node_modules folder.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With