Css-loader: Module not found: Error: Cannot resolve 'file' or 'directory' ./../../../node_modules/css-loader/index.js

Created on 6 Nov 2015  路  9Comments  路  Source: webpack-contrib/css-loader

New to webpack but after several tries I can't manage css-loader to work.

For example I want to use, this example:
https://github.com/ShMcK/WebpackAngularDemos/tree/master/Part3

And after try to run webpack I receive several errors, related to css-loader & style-loader, every other loader seems to be working fine.

ERROR in ./core/nav/nav.scss
Module not found: Error: Cannot resolve 'file' or 'directory' ./../../../node_modules/css-loader/index.js in C:\xampp\htdocs\webpack/app\core\nav
@ ./core/nav/nav.scss 4:14-126 13:2-17:4 14:20-132

Enviroment:

  • Tested on two separate environments:
  • Windows 10Pro & 8.1 Pro
  • npm 3.3.10
  • node 4.2.1

Most helpful comment

change
var APP = __dirname + '/app';
to
var APP = path.resolve(__dirname, 'app')

from: https://github.com/webpack/webpack/issues/1396

All 9 comments

I also has this issues

I also has this issues

Enviroment:
Windows 10Pro
npm 2.14.7
node 4.2.3

Same issues for me.
https://github.com/opendivision/React-ES6-Boilerplate

Tried "--save", "--save-dev", but no change.

change
var APP = __dirname + '/app';
to
var APP = path.resolve(__dirname, 'app')

from: https://github.com/webpack/webpack/issues/1396

I am experiencing the same issues:

Windows 10 Pro
npm 2.14.12
node 4.3.0

For me in Windows 8.1 inside webpack.config.js after doing following change solved issue above:
context: path.resolve(__dirname, 'app')

@bharatpatil Thank you, this works for me.
I have windows environment.

:+1:

@bharatpatil Thank you, this works for me.

Was this page helpful?
0 / 5 - 0 ratings