我在webpack
项目中使用angular 2
。它与npm
一起运行正常,但在我使用`ng'安装npm install -g angular-cli
后命令创建组件或构建然后它显示以下错误。
TypeError中的错误:无法读取属性'请求'未定义的
ExternalModuleFactoryPlugin.js:37 handleExternals [BackofficeVidapayCRM] / [的WebPack] /lib/ExternalModuleFactoryPlugin.js:37:33
ExternalModuleFactoryPlugin.js:46接下来 [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] / [角-CLI] / [的WebPack] /lib/NormalModuleFactory.js:20 7:3
Tapable.js:168 [BackofficeVidapayCRM] / [tapable] /lib/Tapable.js:168:11
NormalModuleReplacementPlugin.js:26 NormalModuleFactory。 [BackofficeVidapayCRM] / [角-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] / [角-CLI] / [的WebPack] /lib/NormalModuleFactory.js:19 1:8
Compilation.js:359 Compilation.process [as _addModuleChain] [BackofficeVidapayCRM] / [角-CLI] / [的WebPack] /lib/Compilation.js:359:16
Compilation.js:435 Compilation.process [as addEntry] [BackofficeVidapayCRM] / [角-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编译器。 [BackofficeVidapayCRM] / [角-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] / [角-CLI] / [的WebPack] /lib/Compiler.js:456:7
Compiler.js:265 Compiler.runAsChild [BackofficeVidapayCRM] / [角-CLI] / [的WebPack] /lib/Compiler.js:265:7
compiler.js:70 [BackofficeVidapayCRM] / [HTML-的WebPack-插件] /lib/compiler.js:70:19
debuggability.js:299 Promise._execute [BackofficeVidapayCRM] / [蓝鸟] /js/release/debuggability.js:299:9
promise.js:481 Promise._resolveFromExecutor [BackofficeVidapayCRM] / [蓝鸟] /js/release/promise.js:481:18
promise.js:77新承诺 [BackofficeVidapayCRM] / [蓝鸟] /js/release/promise.js:77:14
compiler.js:69 Object.compileTemplate [BackofficeVidapayCRM] / [HTML-的WebPack-插件] /lib/compiler.js:69:10
index.js:47编译器。 [BackofficeVidapayCRM] / [HTML-的WebPack-插件] /index.js:47:40
Tapable.js:193 Compiler.applyPluginsParallel [BackofficeVidapayCRM] / [tapable] /lib/Tapable.js:193:14
Compiler.js:463编译器。 [BackofficeVidapayCRM] / [角-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] / [角-CLI] / [的WebPack] /lib/Compiler.js:456:7
Compiler.js:219编译器。 [BackofficeVidapayCRM] / [角-CLI] / [的WebPack] /lib/Compiler.js:219:10
Compiler.js:367 Compiler.readRecords [BackofficeVidapayCRM] / [角-CLI] / [的WebPack] /lib/Compiler.js:367:10
Compiler.js:216编译器。 [BackofficeVidapayCRM] / [角-CLI] / [的WebPack] /lib/Compiler.js:216:9
Tapable.js:102 next [BackofficeVidapayCRM] / [tapable] /lib/Tapable.js:102:11
CachePlugin.js:34编译器。 [BackofficeVidapayCRM] / [角-CLI] / [的WebPack] /lib/CachePlugin.js:34:58
Tapable.js:106 Compiler.applyPluginsAsyncSeries [BackofficeVidapayCRM] / [tapable] /lib/Tapable.js:106:13
Compiler.js:213编译器。 [BackofficeVidapayCRM] / [角-CLI] / [的WebPack] /lib/Compiler.js:213:8
Tapable.js:102 next [BackofficeVidapayCRM] / [tapable] /lib/Tapable.js:102:11
NodeEnvironmentPlugin.js:23编译器。 [BackofficeVidapayCRM] / [角-CLI] / [的WebPack] / LIB /节点/ NodeEnvironmentPlugi n.js:23:3
Tapable.js:106 Compiler.applyPluginsAsyncSeries [BackofficeVidapayCRM] / [tapable] /lib/Tapable.js:106:13
Compiler.js:210 Compiler.run [BackofficeVidapayCRM] / [角-CLI] / [的WebPack] /lib/Compiler.js:210:7
集结webpack.js:21 [BackofficeVidapayCRM] / [角-CLI] /tasks/build-webpack.js:21:29
build-webpack.js:20 Class.run [BackofficeVidapayCRM] / [角-CLI] /tasks/build-webpack.js:20:16
build.js:54 Class.run [BackofficeVidapayCRM] / [角-CLI] /commands/build.js:54:26
command.js:152 Class。 [BackofficeVidapayCRM] / [角-CLI] /angular-cli/lib/models/command.js:152:17
next_tick.js:103 process._tickCallback 内部/过程/ 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"
}
}
请帮我解决这个问题。
答案 0 :(得分:1)
您可以在路径上查看package.json以查看您的webpack版本是否过低,我只需将我的webpack版本更新为2.x,然后尝试'npm install webpack --save-dev'again,它的工作原理