Here's my pacjage.json:
{
"name": "redux-todo",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "webpack-dev-server"
},
"devDependencies": {
"babel": "^6.5.2",
"babel-loader": "^6.2.5",
"babel-preset-es2015": "^6.13.2",
"babel-preset-react": "^6.11.1",
"webpack": "^1.13.2"
},
"dependencies": {
"react": "^15.3.1",
"react-dom": "^15.3.1",
"react-redux": "^4.4.5",
"redux": "^3.5.2"
}
}
webpack.config.js:
var path = require('path');
module.exports = {
entry: './index.js',
output: {
path: './',
filename: 'app.js'
},
devServer: {
inline: true,
port: 3334
},
resolveLoader: { root: path.join(__dirname, "node_modules") },
module: {
loaders: [
{
test: /\.js$/,
exclude: '/node_modules',
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}
]
}
};
and I have following project directory structure:
├── actions.js
├── components
├── containers
├── index.js
├── node_modules
├── package.json
├── reducers.js
├── test.js
└── webpack.config.js
the absolute path to project dir is /home/dmitriy/WebstormProjects/Redux-todo
so why when I run npm start
it crashes with error:
ERROR in (webpack)/~/process/browser.js Module build failed: Error: Couldn't find preset "es2015" relative to directory "/usr/local/lib/node_modules/webpack/node_modules/process"
what's this /usr/local/lib/node_modules/webpack/node_modules/process
path and why it says that it searches relative to it?
Googling this error I found that
IMPORTANT: The loaders here are resolved relative to the resource which they are applied to. This means they are not resolved relative the the configuration file. If you have loaders installed from npm and your node_modules folder is not in a parent folder of all source files, webpack cannot find the loader. You need to add the node_modules folder as absolute path to the resolveLoader.root option. (resolveLoader: { root: path.join(__dirname, "node_modules") })
should fix it, but as you can see I have it in my config and still seeing this error.
I'm on ubuntu 16.04 LTS, nodejs version is 4.2.6, npm 3.5.2