Skip to content

Build: Beta 30, No module factory for ContextElementDependency #4410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DennisSmolek opened this issue Feb 3, 2017 · 11 comments
Closed

Build: Beta 30, No module factory for ContextElementDependency #4410

DennisSmolek opened this issue Feb 3, 2017 · 11 comments

Comments

@DennisSmolek
Copy link

OS?

Linux x64

Versions

@angular/cli: 1.0.0-beta.30
node: 6.9.4
os: linux x64
@angular/common: 2.4.6
@angular/compiler: 2.4.6
@angular/core: 2.4.6
@angular/flex-layout: 2.0.0-beta.4
@angular/forms: 2.4.6
@angular/http: 2.4.6
@angular/material: 2.0.0-beta.1
@angular/platform-browser: 2.4.6
@angular/platform-browser-dynamic: 2.4.6
@angular/router: 3.4.6
@angular/cli: 1.0.0-beta.30
@angular/compiler-cli: 2.4.5

Repro steps.

On my local mac build everything is working fine but when we try to do a codeship deployment it is throwing errors.
I've reset the cache and it should be working.. I've tried a few of the different fixes rolling around but no luck so far.

I'm including our build script(a bit bloated with trying to fix this error) and my package.json

This is the EXACT same error report as #4246 but his was for AOT and mine is working on mac but not on linux so I'm not sure what the issue is..

The log given by the failure.

44% building modules 441/763 modules 322 active ...dules/core-js/modules/es6.weak-map.js
An error occured during the build:
Error: No module factory available for dependency type: ContextElementDependency
at Compilation.addModuleDependencies (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:186:21)
at Compilation.processModuleDependencies (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:175:8)
at _this.buildModule.err (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:315:13)
at building.forEach.cb (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:125:27)
at Array.forEach (native)
at callback (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:125:13)
at module.build (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:147:11)
at ContextModule.<anonymous> (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/ContextModule.js:118:3)
at /home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@ngtools/webpack/src/utils.js:11:13
at /home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@ngtools/webpack/src/plugin.js:196:124
at ContextModule.resolveDependencies (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@ngtools/webpack/src/utils.js:5:9)
at ContextModule.build (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/ContextModule.js:99:7)
at Compilation.buildModule (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:127:10)
at factoryCallback (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:304:11)
at /home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/ContextModuleFactory.js:96:12
at /home/rof/src/github.com/RoamDirectories/showman-web/node_modules/tapable/lib/Tapable.js:168:11
at /home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@ngtools/webpack/src/plugin.js:197:28
No module factory available for dependency type: ContextElementDependency
Error: No module factory available for dependency type: ContextElementDependency
at Compilation.addModuleDependencies (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:186:21)
at Compilation.processModuleDependencies (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:175:8)
at _this.buildModule.err (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:315:13)
at building.forEach.cb (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:125:27)
at Array.forEach (native)
at callback (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:125:13)
at module.build (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:147:11)
at ContextModule.<anonymous> (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/ContextModule.js:118:3)
at /home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@ngtools/webpack/src/utils.js:11:13
at /home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@ngtools/webpack/src/plugin.js:196:124
at ContextModule.resolveDependencies (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@ngtools/webpack/src/utils.js:5:9)
at ContextModule.build (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/ContextModule.js:99:7)
at Compilation.buildModule (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:127:10)
at factoryCallback (/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/Compilation.js:304:11)
at /home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/cli/node_modules/webpack/lib/ContextModuleFactory.js:96:12
at /home/rof/src/github.com/RoamDirectories/showman-web/node_modules/tapable/lib/Tapable.js:168:11
at /home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@ngtools/webpack/src/plugin.js:197:28

Build script:

# npm install
nvm install v6.9.4
nvm use v6.9.4
npm install -g firebase-tools
npm install
npm install -g rxjs
npm install -g @angular/cli@latest
ng -v
ng build --prod --env=staging
#deploy
firebase use staging --token "$FIREBASE_TOKEN"
firebase deploy --token "$FIREBASE_TOKEN"
#update bugsnag
BUGSNAG_API_KEY=${BUGSNAG_API_KEY:?'You need to configure the BUGSNAG_API_KEY environment variable!'}
BUGSNAG_RELEASE_STAGE=staging
BUGSNAG_BRANCH=$CI_BRANCH
BUGSNAG_REVISION=$CI_COMMIT_ID
BUGSNAG_REPOSITORY=$(git config --get remote.origin.url)
CURL_PATH="apiKey=${BUGSNAG_API_KEY}&branch=${BUGSNAG_BRANCH}&repository=${BUGSNAG_REPOSITORY}&revision=${BUGSNAG_REVISION}&releaseStage=${BUGSNAG_RELEASE_STAGE}"
echo "$CURL_PATH"
curl -d "$CURL_PATH" https://notify.bugsnag.com/deploy

Package.json

{
  "name": "showman-web",
  "version": "0.0.0",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\" --project src/tsconfig.json --type-check && tslint \"e2e/**/*.ts\" --project e2e/tsconfig.json --type-check",
    "test": "ng test",
    "pree2e": "webdriver-manager update --standalone false --gecko false",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "^2.4.6",
    "@angular/compiler": "^2.4.6",
    "@angular/core": "^2.4.6",
    "@angular/flex-layout": "^2.0.0-beta.4",
    "@angular/forms": "^2.4.6",
    "@angular/http": "^2.4.6",
    "@angular/material": "^2.0.0-beta.1",
    "@angular/platform-browser": "^2.4.6",
    "@angular/platform-browser-dynamic": "^2.4.6",
    "@angular/router": "^3.4.6",
    "@types/bugsnag": "^2.5.28",
    "@types/crypto-js": "^3.1.33",
    "@types/dropzone": "^4.3.34",
    "@types/lodash": "^4.14.52",
    "@types/request": "0.0.39",
    "angular2-contextmenu": "^0.7.4",
    "angular2-cookie": "^1.2.6",
    "angular2-hotkeys": "^1.0.2",
    "angularfire2": "^2.0.0-beta.7",
    "cloudinary-core": "^2.1.9",
    "core-js": "^2.4.1",
    "crypto-js": "^3.1.9-1",
    "dropzone": "^4.3.0",
    "firebase": "^3.6.7",
    "hammerjs": "^2.0.8",
    "moment": "^2.17.1",
    "rxjs": "^5.0.1",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.2"
  },
  "devDependencies": {
    "@angular/cli": "^1.0.0-beta.30",
    "@angular/compiler-cli": "^2.3.1",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.26",
    "codelyzer": "~2.0.0-beta.1",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "~4.0.13",
    "ts-node": "1.2.1",
    "tslint": "^4.3.0",
    "typescript": "~2.0.3"
  }
}
@hansl
Copy link
Contributor

hansl commented Feb 3, 2017

You should remove the dependency to angular-cli and retry.

@DennisSmolek
Copy link
Author

@hansl, good catch trying now..

@DennisSmolek
Copy link
Author

DennisSmolek commented Feb 3, 2017

update

Removed the dep on angular-cli which did the exact same thing as adding:

npm install @ngtools/[email protected] --save
npm install [email protected]

as this seems to have fixed some peoples issues.. got past where it was breaking before but now its complaining about modules. What's weird is we aren't using any of these components, they are leftovers we havent removed yet..

Not sure how those two things are related, I'm grabbing lunch as my minds getting fuzzy..

error

ERROR in Cannot determine the module for class CollectionListComponent in /home/rof/src/github.com/RoamDirectories/showman-web/src/app/collections/collection-list.component.ts!
Cannot determine the module for class GroupByPipe in /home/rof/src/github.com/RoamDirectories/showman-web/src/app/shared/pipes.ts!
Cannot determine the module for class CheatSheetComponent in /home/rof/src/github.com/RoamDirectories/showman-web/src/app/hotkeysTemp/src/cheatsheet.component.ts!
Cannot determine the module for class HotkeysDirective in /home/rof/src/github.com/RoamDirectories/showman-web/src/app/hotkeysTemp/src/hotkeys.directive.ts!

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/core/root-app/root-app.module.ngfactory' in '/home/rof/src/github.com/RoamDirectories/showman-web/src'
@ ./src/main.ts 4:0-93
@ multi ./src/main.ts

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/home/rof/src/github.com/RoamDirectories/showman-web/src/$$_gendir' in '/home/rof/src/github.com/RoamDirectories/showman-web/node_modules/@angular/core/src/linker'
@ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 71:15-36 87:15-102
@ ./~/@angular/core/src/linker.js
@ ./~/@angular/core/src/core.js
@ ./~/@angular/core/index.js
@ ./src/main.ts
@ multi ./src/main.ts

@cghislai
Copy link

cghislai commented Feb 5, 2017

I resolved this issue by downgrading to @angular/cli beta.29 and [email protected].
I removed nodes_modules, ran npm i , then build passed (with and without aot, using lazy loaded modules).
@angular/cli: 1.0.0-beta.29
node: 6.9.5
os: linux x64
@angular/common: 2.4.6
@angular/compiler: 2.4.6
@angular/core: 2.4.6
@angular/forms: 2.4.6
@angular/http: 2.4.6
@angular/platform-browser: 2.4.6
@angular/platform-browser-dynamic: 2.4.6
@angular/router: 3.4.6
@angular/cli: 1.0.0-beta.29
@angular/compiler-cli: 2.4.6

@uberspeck
Copy link

I was seeing the same issue w/[email protected]. I downgraded webpack to 2.2.0 and it fixed it for me...

  "dependencies": {
    "@angular/common": "^2.3.1",
    "@angular/compiler": "^2.3.1",
    "@angular/core": "^2.3.1",
    "@angular/forms": "^2.3.1",
    "@angular/http": "^2.3.1",
    "@angular/platform-browser": "^2.3.1",
    "@angular/platform-browser-dynamic": "^2.3.1",
    "@angular/router": "^3.3.1",
    "bootstrap": "^3.3.7",
    "core-js": "^2.4.1",
    "rxjs": "^5.0.1",
    "ts-helpers": "^1.1.1",
    "zone.js": "^0.7.2"
  },
  "devDependencies": {
    "@angular/compiler-cli": "^2.3.1",
    "@types/jasmine": "2.5.38",
    "@types/node": "^6.0.42",
    "angular-cli": "1.0.0-beta.26",
    "codelyzer": "~2.0.0-beta.1",
    "jasmine-core": "2.5.2",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "^2.0.0",
    "karma-cli": "^1.0.1",
    "karma-jasmine": "^1.0.2",
    "karma-remap-istanbul": "^0.2.1",
    "protractor": "~4.0.13",
    "ts-node": "1.2.1",
    "tslint": "^4.3.0",
    "typescript": "~2.0.3",
    "webpack": "2.2.0"
  }

@isaacplmann
Copy link

I got this same error when I used yarn to install packages instead of npm install. Took me a while to figure this out - hope it helps someone.

@filipesilva
Copy link
Contributor

This doesn't happen anymore I believe. If you're experiencing this issue, have a look at https://github.com/angular/angular-cli/wiki/stories-rc-update to update your project.

@brockklein
Copy link

Received this error today after upgrading to CLI 1.0.0 (and Angular 4.0.0). Putting Webpack at ~2.2.0 fixed it for me.

@crtl
Copy link

crtl commented Jul 10, 2017

I got this error too after upgrading to 1,2,
I tried to reinstall @angualr/cli which didnt work. Then I've created an empty project and copied all required dependencies including the versions into my old package.json.

@bobKasbi
Copy link

For me was just removing webpack from package.json and reinstalling @angular/cli.
Now working fine.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants