Skip to content

ng build --prod: Cannot find module css-loader/index.js?sourcemap&minimize #4292

Closed
@francisoud

Description

@francisoud

Versions.

ng --version
angular-cli: 1.0.0-beta.21
node: 6.9.1
os: win32 x64

Repro steps.

npm cache clean
npm install --no-optional
ng build --prod

The log given by the failure.

Module build failed: Error: Cannot find module '/var/bamboo/xml-data/build-dir/JOB1/node_modules/css-loader/index.js?sourcemap&minimize'
        at Function.Module._resolveFilename (module.js:469:15)
        at Function.Module._load (module.js:417:25)
...

Mention any other details that might be useful.

Well actually I found the reason and the fix (it just for the record if anyone has the same issue...):
In [email protected] / package.json this following line:

"extract-text-webpack-plugin": "^2.0.0-beta.4",

Resolved to different incompatible extract-text-webpack-plugin version:

25 jan. 17

Changed to:

30 jan. 17

Solution

Do a npm shrinkwrap but if it's too late, add the following line to your package.json:

"devDependencies": {
    "extract-text-webpack-plugin": "2.0.0-beta.5"
},

Another problem

After fixing this you may get a lodash error:

Error in bail mode: [default] /var/bamboo/xml-data/build-dir/JOB1/node_modules/@types/lodash/index.d.ts:245:24 
Cannot find name 'Partial'.

change the dependency to

"@types/lodash": "4.14.50",

make sure you don't take the v4.14.51

ps: Don't forget to delete you node_modules and run npm cache clean before npm install

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions