TypeError:无法读取使用angular-cli定义的未定义属性"request" [英] TypeError: Cannot read property 'request' of undefined with angular-cli

查看:79
本文介绍了TypeError:无法读取使用angular-cli定义的未定义属性"request"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在angular 2项目中使用webpack. npm可以正常工作,但是在安装npm install -g angular-cli后,当我使用`ng'命令创建组件或进行构建时,它显示以下错误.

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.

TypeError中的错误:无法读取未定义的属性"request"

ERROR in TypeError: Cannot read property 'request' of undefined

  • ExternalModuleFactoryPlugin.js:37 handleExternals [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:37:33

  • ExternalModuleFactoryPlugin.js:37 handleExternals [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:37:33

ExternalModuleFactoryPlugin.js:46下一个 [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:46:8

ExternalModuleFactoryPlugin.js:46 next [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:46:8

ExternalModuleFactoryPlugin.js:59 handleExternals [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:59:7

ExternalModuleFactoryPlugin.js:59 handleExternals [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:59:7

ExternalModuleFactoryPlugin.js:79 ExternalModuleFactoryPlugin. [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:79:5

ExternalModuleFactoryPlugin.js:79 ExternalModuleFactoryPlugin. [BackofficeVidapayCRM]/[webpack]/lib/ExternalModuleFactoryPlugin.js:79:5

NormalModuleFactory.js:207 [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/NormalModuleFactory.js:20 7:3

NormalModuleFactory.js:207 [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/NormalModuleFactory.js:20 7:3

Tapable.js:168 [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:168:11

Tapable.js:168 [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:168:11

NormalModuleReplacementPlugin.js:26 NormalModuleFactory. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/NormalModuleReplacementPl ugin.js:26: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

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

NormalModuleFactory.js:191 NormalModuleFactory.create [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/NormalModuleFactory.js:19 1:8

Compilation.js:359 Compilation.process [作为_addModuleChain] [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compilation.js:359:16

Compilation.js:359 Compilation.process [as _addModuleChain] [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compilation.js:359:16

Compilation.js:435 Compilation.process [作为addEntry] [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compilation.js:435:7

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

SingleEntryPlugin.js:22 SingleEntryPlugin. [BackofficeVidapayCRM]/[webpack]/lib/SingleEntryPlugin.js:22:15

Tapable.js:193 Compiler.applyPluginsParallel [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:193:14

Tapable.js:193 Compiler.applyPluginsParallel [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:193:14

Compiler.js:463编译器. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:463:8

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

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: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:265 Compiler.runAsChild [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:265:7

compiler.js:70 [BackofficeVidapayCRM]/[html-webpack-plugin]/lib/compiler.js:70:19

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

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:481 Promise._resolveFromExecutor [BackofficeVidapayCRM]/[bluebird]/js/release/promise.js:481:18

promise.js:77个新的Promise [BackofficeVidapayCRM]/[bluebird]/js/release/promise.js:77:14

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

compiler.js:69 Object.compileTemplate [BackofficeVidapayCRM]/[html-webpack-plugin]/lib/compiler.js:69:10

index.js:47编译器. [BackofficeVidapayCRM]/[html-webpack-plugin]/index.js:47:40

index.js:47 Compiler. [BackofficeVidapayCRM]/[html-webpack-plugin]/index.js:47:40

Tapable.js:193 Compiler.applyPluginsParallel [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:193:14

Tapable.js:193 Compiler.applyPluginsParallel [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:193:14

Compiler.js:463编译器. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:463:8

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

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:456 Compiler.compile [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:456:7

Compiler.js:219编译器. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:219:10

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:367 Compiler.readRecords [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:367:10

Compiler.js:216编译器. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:216:9

Compiler.js:216 Compiler. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:216:9

Tapable.js:102下一个 [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:102:11

Tapable.js:102 next [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:102:11

CachePlugin.js:34编译器. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/CachePlugin.js:34:58

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

Tapable.js:106 Compiler.applyPluginsAsyncSeries [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:106:13

Compiler.js:213编译器. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:213:8

Compiler.js:213 Compiler. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/Compiler.js:213:8

Tapable.js:102下一个 [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:102:11

Tapable.js:102 next [BackofficeVidapayCRM]/[tapable]/lib/Tapable.js:102:11

NodeEnvironmentPlugin.js:23编译器. [BackofficeVidapayCRM]/[angular-cli]/[webpack]/lib/node/NodeEnvironmentPlugi n.js:23:3

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

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

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: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-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

build.js:54 Class.run [BackofficeVidapayCRM]/[angular-cli]/commands/build.js:54:26

command.js:152类. [BackofficeVidapayCRM]/[angular-cli]/angular-cli/lib/models/command.js:152:17

command.js:152 Class. [BackofficeVidapayCRM]/[angular-cli]/angular-cli/lib/models/command.js:152:17

next_tick.js:103进程._tickCallback 内部/进程/next_tick.js:103:7

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.

推荐答案

您可以在路径上检查package.json,以查看您的webpack版本是否太低,我只是将我的webpack版本更新为2.x,并再次尝试"npm install webpack --save-dev",

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

这篇关于TypeError:无法读取使用angular-cli定义的未定义属性"request"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆