Nx: Error: No module factory available for dependency type: ContextElementDependency

Created on 26 Jan 2019  Â·  4Comments  Â·  Source: nrwl/nx

Failure Information (for bugs)

After upgrading to latest @angular-devkit/build-angular and latest @nrwl/builders I'm getting the following error:

× 「wdm」: Error: No module factory available for dependency type: ContextElementDependency
    at addDependency (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:694:12)
    at iterationOfArrayCallback (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:194:3)
    at addDependenciesBlock (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:712:5)
    at iterationOfArrayCallback (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:194:3)
    at addDependenciesBlock (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:715:5)
    at Compilation.processModuleDependencies (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:723:4)
    at afterBuild (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:855:15)
    at buildModule.err (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:899:11)
    at callback (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:628:5)
    at module.build.error (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:676:12)
    at resolveDependencies (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\ContextModule.js:282:4)
    at ContextModule.result.resolveDependencies (C:\Users\Nella\Documents\GitHub\roster\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:517:25)
    at ContextModule.build (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\ContextModule.js:203:8)
    at Compilation.buildModule (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:633:10)
    at factory.create (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\Compilation.js:882:14)
    at hooks.afterResolve.callAsync (C:\Users\Nella\Documents\GitHub\roster\node_modules\webpack\lib\ContextModuleFactory.js:163:16)
C:\Users\Nella\Documents\GitHub\roster\node_modules\neo-async\async.js:14
    throw new Error('Callback was already called.');
    ^

Error: Callback was already called.
    at throwError (C:\Users\Nella\Documents\GitHub\roster\node_modules\neo-async\async.js:14:11)
    at C:\Users\Nella\Documents\GitHub\roster\node_modules\neo-async\async.js:2813:7
    at process._tickCallback (internal/process/next_tick.js:61:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `ng serve --configuration development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start 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!     C:\Users\Nella\AppData\Roaming\npm-cache\_logs\2019-01-26T18_03_38_669Z-debug.log

running npm ls webpack reveals the likely cause of the issue:

+-- @angular-devkit/[email protected]
| `-- [email protected]
`-- @nrwl/[email protected]
  `-- [email protected]

more info: https://github.com/angular/angular-cli/issues/6417

Most helpful comment

fixed by:

npm uninstall --save-dev webpack
sudo rm -R node_modules
rm -R package-lock.json
npm install

Ref https://github.com/angular/angular-cli/issues/6417

All 4 comments

Update: I was able to get this to work by downgrading to to @nrwl/[email protected] then updating back to 7.5.0 via ng update @nrwl/builders

I am having a similar problem here's my result of npm ls webpack after upgrading:

+-- @nrwl/[email protected]
\| +-- @angular-devkit/[email protected]
\| \| `-- [email protected]  deduped
\| `-- [email protected]
`-- [email protected]
--

@swapnil0545 see if downgrading just @nrwl/builders to the previous version then re-upgrading works for you. If not, you'll probably want to open a new issue for better visibility to the Nx team.

fixed by:

npm uninstall --save-dev webpack
sudo rm -R node_modules
rm -R package-lock.json
npm install

Ref https://github.com/angular/angular-cli/issues/6417

Was this page helpful?
0 / 5 - 0 ratings

Related issues

joelmuskwe picture joelmuskwe  Â·  3Comments

Svancara picture Svancara  Â·  3Comments

danieldanielecki picture danieldanielecki  Â·  3Comments

zpydee picture zpydee  Â·  3Comments

zachnewburgh picture zachnewburgh  Â·  3Comments