Closed AndreyYevtukhov closed 6 years ago
Error in npm's debug.log
13 verbose stack Error: serviceName@0.0.0 bd:
ng build --watch --deploy-url=src/
13 verbose stack Exit status 1 13 verbose stack at EventEmitter.(C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16) 13 verbose stack at emitTwo (events.js:126:13) 13 verbose stack at EventEmitter.emit (events.js:214:7) 13 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14) 13 verbose stack at emitTwo (events.js:126:13) 13 verbose stack at ChildProcess.emit (events.js:214:7) 13 verbose stack at maybeClose (internal/child_process.js:925:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
same here. ng serve then ctrl - c then run ng-serve throw error port 4200 is in use.
Same issue here after migrating from 1.6.6 to 1.7.0:
23% building modules 110/122 modules 12 active ...\kendo-angular-upload\dist\es\main.js
An error occured during the build:
Error: No module factory available for dependency type: ContextElementDependency
I had the same issue with LazyLoading routing feature difference and angular-cli 1.6.8 -> 1.7.0
Angular CLI: 1.7.0
Node: 7.10.1
OS: darwin x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular/cdk: 5.0.0
@angular/cli: 1.7.0
@angular/material: 5.0.0
@angular-devkit/build-optimizer: 0.3.1
@angular-devkit/core: 0.3.1
@angular-devkit/schematics: 0.3.1
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.0
@schematics/angular: 0.3.1
@schematics/package-update: 0.3.1
typescript: 2.5.3
webpack: 3.11.0
Same issue here. Made no changes and upgraded and got the same error.
67% building modules 666/694 modules 28 active . No module factory available for dependency type: ContextElementDependency
Versions:
"@angular/cli": "^1.7.0",
"@angular/compiler-cli": "^5.2.5",
"@angular/language-service": "^5.2.5",
"@angular/animations": "^5.2.5",
"@angular/common": "^5.2.5",
"@angular/compiler": "^5.2.5",
"@angular/core": "^5.2.5",
"@angular/forms": "^5.2.5",
"@angular/http": "^5.2.5",
"@angular/platform-browser": "^5.2.5",
"@angular/platform-browser-dynamic": "^5.2.5",
"@angular/router": "^5.2.5",
"rxjs": "^5.5.6",
"zone.js": "^0.8.20"
"ts-node": "^4.1.0",
"tslint": "^5.9.0",
"typescript": "^2.6.2",
Tested on 1.7.1 and still happening :(
Heya, this issue is a duplicate of https://github.com/angular/angular-cli/issues/6417. You can see the answer to it in https://github.com/angular/angular-cli/issues/6417#issuecomment-315708400.
The short version is that you can't have multiple versions of webpack on your node_modules. Removing the extra webpack installs should fix it.
This was happening for me because I had storybook installed which comes with its own webpack version.
@filipesilva
Hi, I've seen your explanation over and over but I haven't been able to build app without explicitly installing webpack in my devDependencies since cli version 1.6 or so.
Without webpack I've been getting this error Cannot find module 'webpack/lib/node/NodeTemplatePlugin'
.
That was always fixed by having webpack in devDependencies
.
Now after upgrading to RC 6 versions I'm getting exactly same ContextElementDependency
error and removing webpack
from devDependencies
simply causes the NodeTemplatePlugin
error again.
I wonder what's wrong here.
@angular 6.0.0-rc.1
@angular/cli v6.0.0-rc.0
webpack 4.4.1
I have the exact same issue with the NodeTemplatePlugin error. The only way to fix is is by installing a higher webpack version ...
Do anyone get a solution to this error?
@AlaaAhmedBM try this answer just remove the package-lock.json before npm install it worked for me!
I have the same issue.
I've search for solutions and uninstall webpack
from my project.
When I run the command : ng serve
, I have another one: Cannot find module webpack
.
Its very annoying.
@yzini-eagle , seeing your solution. What I have tried is :
node_modules
.package-lock.json
.npm cache clean --force
npm install
It worked. However, I don't know what the root cause is.
This works just fine for me with angular 6: remove webpack from DevDependencies in Package.json rimraf node_modules/ (remove node_modules folder) rimraf package-lock.json (remove package-lock.json file) npm install -g webpack (install webpack globally) npm install -g webpack-dev-server npm install ng serve or ng build
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
Having a build error after update to
1.7.0
No module factory available for dependency type: ContextElementDependency
Versions
ng -v
Angular CLI: 1.7.0 Node: 8.9.1 OS: win32 x64 Angular: 5.2.5 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router
@ angular/cli: 1.7.0 @ angular-devkit/build-optimizer: 0.3.1 @ angular-devkit/core: 0.3.1 @ angular-devkit/schematics: 0.3.1 @ ngtools/json-schema: 1.2.0 @ ngtools/webpack: 1.10.0 @ schematics/angular: 0.3.1 @ schematics/package-update: 0.3.1 typescript: 2.4.2 webpack-dev-server: 2.9.7 webpack: 3.10.0
P.s.
node_modules
and reinstalling withnpm i
- didn't helpnpm i @angular/cli --save-dev
- didn't help1.6.8
- helped