I am using webpack in my angular 2 project. It is working fine with npm but after installing npm install -g angular-cli when I use `ng' command to create component or to build then it is showing below error.
ERROR in TypeError: Cannot read property 'request' of undefined
ExternalModuleFactoryPlugin.js:37 handleExternals [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:37:33
ExternalModuleFactoryPlugin.js:46 next [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:46:8
ExternalModuleFactoryPlugin.js:59 handleExternals [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:59:7
ExternalModuleFactoryPlugin.js:79 ExternalModuleFactoryPlugin. [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:79:5
NormalModuleFactory.js:207 [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/NormalModuleFactory.js:20 7:3
Tapable.js:168 [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:168:11
NormalModuleReplacementPlugin.js:26 NormalModuleFactory. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/NormalModuleReplacementPl ugin.js:26:11
Tapable.js:172 NormalModuleFactory.applyPluginsAsyncWaterfall [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:172:13
NormalModuleFactory.js:191 NormalModuleFactory.create [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/NormalModuleFactory.js:19 1:8
Compilation.js:359 Compilation.process [as _addModuleChain] [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compilation.js:359:16
Compilation.js:435 Compilation.process [as addEntry] [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compilation.js:435:7
SingleEntryPlugin.js:22 SingleEntryPlugin. [BackofficeVidapayCRM]/[webpack]/lib/SingleEntryPlugin.js:22:15
Tapable.js:193 Compiler.applyPluginsParallel [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:193:14
Compiler.js:463 Compiler. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:463:8
Tapable.js:95 Compiler.applyPluginsAsyncSeries [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:95:46
Compiler.js:456 Compiler.compile [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:456:7
Compiler.js:265 Compiler.runAsChild [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:265:7
compiler.js:70 [BackofficeVidapayCRM]/[html-webpack-plugin]/lib/compiler.js:70:19
debuggability.js:299 Promise._execute [BackofficeVidapayCRM]/[bluebird]/js/release/debuggability.js:299:9
promise.js:481 Promise._resolveFromExecutor [BackofficeVidapayCRM]/[bluebird]/js/release/promise.js:481:18
promise.js:77 new Promise [BackofficeVidapayCRM]/[bluebird]/js/release/promise.js:77:14
compiler.js:69 Object.compileTemplate [BackofficeVidapayCRM]/[html-webpack-plugin]/lib/compiler.js:69:10
index.js:47 Compiler. [BackofficeVidapayCRM]/[html-webpack-plugin]/index.js:47:40
Tapable.js:193 Compiler.applyPluginsParallel [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:193:14
Compiler.js:463 Compiler. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:463:8
Tapable.js:95 Compiler.applyPluginsAsyncSeries [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:95:46
Compiler.js:456 Compiler.compile [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:456:7
Compiler.js:219 Compiler. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:219:10
Compiler.js:367 Compiler.readRecords [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:367:10
Compiler.js:216 Compiler. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:216:9
Tapable.js:102 next [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:102:11
CachePlugin.js:34 Compiler. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/CachePlugin.js:34:58
Tapable.js:106 Compiler.applyPluginsAsyncSeries [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:106:13
Compiler.js:213 Compiler. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:213:8
Tapable.js:102 next [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:102:11
NodeEnvironmentPlugin.js:23 Compiler. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/node/NodeEnvironmentPlugi n.js:23:3
Tapable.js:106 Compiler.applyPluginsAsyncSeries [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:106:13
Compiler.js:210 Compiler.run [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:210:7
build-webpack.js:21 [BackofficeVidapayCRM]/[angular-cli]/tasks/build-webpack.js:21:29
build-webpack.js:20 Class.run [BackofficeVidapayCRM]/[angular-cli]/tasks/build-webpack.js:20:16
build.js:54 Class.run [BackofficeVidapayCRM]/[angular-cli]/commands/build.js:54:26
command.js:152 Class. [BackofficeVidapayCRM]/[angular-cli]/angular-cli/lib/models/command.js:152:17
next_tick.js:103 process._tickCallback internal/process/next_tick.js:103:7
package.json:
{
"name": "starter",
"version": "0.0.0",
"license": "MIT",
"angular-cli": { },
"scripts": {
"start": "ng serve \"npm run server\"",
"lint": "tslint \"src/**/*.ts\"",
"test": "ng test",
"pree2e": "webdriver-manager update",
"e2e": "protractor",
"typings-install": "typings install",
"postinstall": "npm run typings-install",
"build": "webpack --inline --colors --progress --display-error-details --display-cached",
"server": "webpack-dev-server --inline --colors --progress --display-error-details --display-cached --port 3000 --content-base src"
},
"private": true,
"dependencies": {
"@angular/common": "2.2.3",
"@angular/compiler": "2.2.3",
"@angular/core": "2.2.3",
"@angular/forms": "2.2.3",
"@angular/http": "2.2.3",
"@angular/platform-browser": "2.2.3",
"@angular/platform-browser-dynamic": "2.2.3",
"@angular/router": "3.2.3",
"core-js": "^2.4.1",
"rxjs": "5.0.0-beta.12",
"ts-helpers": "^1.1.1",
"zone.js": "^0.6.23",
"angular2-in-memory-web-api": "0.0.20",
"animate.css": "3.1.1",
"bootstrap": "^3.3.7",
"font-awesome": "^4.6.1",
"ie-shim": "^0.1.0",
"jquery": "^3.1.0",
"metismenu": "^2.5.0",
"pace": "0.0.4",
"pace-progress": "^1.0.2",
"reflect-metadata": "^0.1.3",
"systemjs": "0.19.27"
},
"devDependencies": {
"@angular/compiler-cli": "2.2.3",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"angular-cli": "1.0.0-beta.22-1",
"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.9",
"ts-node": "1.2.1",
"tslint": "^4.0.2",
"typescript": "~2.0.3",
"webdriver-manager": "10.2.5",
"angular2-template-loader": "^0.6.0",
"awesome-typescript-loader": "^3.0.0-beta.13",
"bootstrap-webpack": "0.0.5",
"css-loader": "^0.26.1",
"exports-loader": "^0.6.3",
"expose-loader": "^0.7.1",
"extract-text-webpack-plugin": "^1.0.1",
"file-loader": "^0.9.0",
"imports-loader": "^0.7.0",
"raw-loader": "^0.5.1",
"style-loader": "^0.13.1",
"to-string-loader": "^1.1.5",
"typings": "^2.0.0",
"url-loader": "^0.5.7",
"webpack": "^1.14.0",
"webpack-dev-server": "^1.16.2",
"webpack-merge": "^1.1.1"
}
}
Please help me to solve this.
You can check on package.json on your path to see if your version of your webpack is too low,I just update my webpack version to 2.x,and try 'npm install webpack --save-dev'again, it works
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With