question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't run ng test with @ngtools/webpack 1.3.2

See original GitHub issue

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [ ] feature request

Versions.

                             _                           _  _
  __ _  _ __    __ _  _   _ | |  __ _  _ __         ___ | |(_)
 / _` || '_ \  / _` || | | || | / _` || '__|_____  / __|| || |
| (_| || | | || (_| || |_| || || (_| || |  |_____|| (__ | || |
 \__,_||_| |_| \__, | \__,_||_| \__,_||_|          \___||_||_|
               |___/
@angular/cli: 1.0.0-beta.29
node: 6.10.1
os: darwin x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-beta.29
@angular/compiler-cli: 2.4.8

Repro steps.

After doing a clean npm install, run: ng test --single-run

The log given by the failure.

25 05 2017 15:00:18.993:ERROR [preprocess]: Can not load "webpack"!
  TypeError: Cannot read property 'plugin' of undefined
    at PathsPlugin.apply (/Users/joaoalmeida/MyProj/xxx/node_modules/@ngtools/webpack/src/paths-plugin.js:68:18)
    at Resolver.apply (/Users/joaoalmeida/MyProj/xxx/node_modules/tapable/lib/Tapable.js:306:16)
    at /Users/joaoalmeida/MyProj/xxx/node_modules/enhanced-resolve/lib/ResolverFactory.js:246:12
    at Array.forEach (native)
    at Object.exports.createResolver (/Users/joaoalmeida/MyProj/xxx/node_modules/enhanced-resolve/lib/ResolverFactory.js:245:10)
    at WebpackOptionsApply.process (/Users/joaoalmeida/MyProj/xxx/node_modules/webpack/lib/WebpackOptionsApply.js:282:46)
    at webpack (/Users/joaoalmeida/MyProj/xxx/node_modules/webpack/lib/webpack.js:36:48)
    at new Plugin (/Users/joaoalmeida/MyProj/xxx/node_modules/karma-webpack/lib/karma-webpack.js:63:18)
    at invoke (/Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:75:15)
    at Array.instantiate (/Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:59:20)
    at get (/Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:48:43)
    at /Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:71:14
    at Array.map (native)
    at Array.invoke (/Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:70:31)
    at Injector.get (/Users/joaoalmeida/MyProj/xxx/node_modules/di/lib/injector.js:48:43)
    at instantiatePreprocessor (/Users/joaoalmeida/MyProj/xxx/node_modules/karma/lib/preprocessor.js:55:20)
    at /Users/joaoalmeida/MyProj/xxx/node_modules/karma/lib/preprocessor.js:106:17
    at Array.forEach (native)
    at /Users/joaoalmeida/MyProj/xxx/node_modules/karma/lib/preprocessor.js:103:27
    at module.exports (/Users/joaoalmeida/MyProj/xxx/node_modules/karma/node_modules/isbinaryfile/index.js:28:12)
    at /Users/joaoalmeida/MyProj/xxx/node_modules/karma/lib/preprocessor.js:84:7
    at /Users/joaoalmeida/MyProj/xxx/node_modules/graceful-fs/graceful-fs.js:78:16
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:446:3)
25 05 2017 15:00:19.032:INFO [karma]: Karma v1.2.0 server started at http://localhost:9876/
25 05 2017 15:00:19.032:INFO [launcher]: Launching browser Chrome with unlimited concurrency
25 05 2017 15:00:19.033:ERROR [karma]: Found 1 load error

Desired functionality.

Should run unit tests

Mention any other details that might be useful.

I believe this issue might be related to the last updated on ngtools/webpack . Specifically from version 1.3.1 to 1.3.2.

Package.json from my project

{
  "name": "###",
  "version": "0.0.1",
  "license": "MIT",
  "angular-cli": {},
  "scripts": {
    "start": "ng serve",
    "lint": "tslint \"src/**/*.ts\"",
    "test": "ng test",
    "pree2e": "webdriver-manager update",
    "e2e": "protractor"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "2.4.8",
    "@angular/compiler": "2.4.8",
    "@angular/core": "2.4.8",
    "@angular/forms": "2.4.8",
    "@angular/http": "2.4.8",
    "@angular/platform-browser": "2.4.8",
    "@angular/platform-browser-dynamic": "2.4.8",
    "@angular/router": "3.4.8",
    "@ngrx/core": "1.2.0",
    "@ngrx/effects": "2.0.0",
    "@ngrx/store": "2.2.1",
    "@ngrx/store-devtools": "3.2.2",
    "angular2-recaptcha": "^0.3.7",
    "angular2-text-mask": "^4.1.0",
    "bulma": "0.2.3",
    "core-js": "2.4.1",
    "ng2-file-upload": "1.2.0",
    "ng2-translate": "5.0.0",
    "oidc-token-manager": "1.2.0",
    "rxjs": "5.0.3",
    "ts-helpers": "1.1.2",
    "typescript": "2.0.10",
    "web-animations-js": "2.2.2",
    "zone.js": "0.7.2"
  },
  "devDependencies": {
    "@angular/cli": "1.0.0-beta.29",
    "@angular/compiler-cli": "2.4.8",
    "@types/chai": "3.4.34",
    "@types/isomorphic-fetch": "0.0.32",
    "@types/jasmine": "2.5.41",
    "@types/node": "7.0.3",
    "azure-storage": "1.3.2",
    "codelyzer": "2.0.0-beta.4",
    "faker": "^4.1.0",
    "jasmine-core": "2.4.1",
    "jasmine-reporters": "^2.2.0",
    "jasmine-spec-reporter": "2.5.0",
    "karma": "1.2.0",
    "karma-chrome-launcher": "2.0.0",
    "karma-cli": "1.0.1",
    "karma-coverage": "1.1.1",
    "karma-jasmine": "1.0.2",
    "karma-remap-istanbul": "0.2.1",
    "karma-teamcity-reporter": "1.0.0",
    "node-sass": "3.7.0",
    "protractor": "5.1.0",
    "react": "15.4.2",
    "react-redux": "5.0.2",
    "redux": "3.6.0",
    "redux-devtools": "3.3.2",
    "remap-istanbul": "0.6.4",
    "string-replace-loader": "1.0.3",
    "ts-node": "1.2.1",
    "tslint": "4.3.1",
    "webdriver-manager": "10.2.5",
    "webpack": "~2.2.1"
  }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
onuralpscommented, May 26, 2017

for me adding “@ ngtools/webpack”: “1.3.0” to package.json solved the issue for now but i am not an expert and do not know if there is any side effect.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 7, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular Compiler was detected but it was an instance of the ...
1) updating the package @ngtools/webpack to the latest version. 2) deleting node_modules , package-lock.json and running a clean npm install.
Read more >
angular/angular-cli - Gitter
I'm getting an error ( Cannot convert undefined or null to object ) when I use ng g c test command. Anyone knows...
Read more >
Missing Error Messages with Angular Testing
Running "ng test --sourcemaps=false" solved the problem. ... I updated to 1.3.2, removed the “–sourcemaps=false” option, and verified that ...
Read more >
Updating Angular from 2 to 4 - Ashley Sheridan
I recently needed to upgrade an Angular project from 2.4.1 to the latest (at the time of writing) version of 4.2.
Read more >
Path problem occurs after updating to angular 11 - Ionic Forum
ng.cmd run app:ionic-cordova-build:production --platform=android An unhandled exception occurred: Cannot find module ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found