Angularjs ng发球错误:“;无法读取属性';0';“未定义”的定义;
我是新手。我从下载了Angular 2快速启动模板(app文件夹位于src文件夹内),然后使用VS代码修改packages.json内容,并在app文件夹内为组件/服务等手动创建文件/文件夹。。基于我在网上找到的教程。当我使用Angularjs ng发球错误:“;无法读取属性';0';“未定义”的定义;,angularjs,node.js,Angularjs,Node.js,我是新手。我从下载了Angular 2快速启动模板(app文件夹位于src文件夹内),然后使用VS代码修改packages.json内容,并在app文件夹内为组件/服务等手动创建文件/文件夹。。基于我在网上找到的教程。当我使用npm start启动应用程序时,该应用程序运行良好,但我无法创建DIST文件夹,我需要该文件夹才能将我的应用程序的缩小版本上载到azure web app。每当我从angular 2项目的根运行ng build,我都会得到以下错误: Cannot read propert
npm start
启动应用程序时,该应用程序运行良好,但我无法创建DIST文件夹,我需要该文件夹才能将我的应用程序的缩小版本上载到azure web app。每当我从angular 2项目的根运行ng build
,我都会得到以下错误:
Cannot read property '0' of undefined
TypeError: Cannot read property '0' of undefined
at Class.run (C:\AngularTestProject\node_modules\angular-cli\tasks\build-webpack.js:15:98)
at Class.run (C:\AngularTestProject\node_modules\angular-cli\commands\build.js:51:26)
at Class.<anonymous> (C:\AngularTestProject\node_modules\angular-cli\angular-cli\lib\models\command.js:152:17)
at process._tickCallback (internal/process/next_tick.js:103:7)
最后是我的应用程序的文件夹结构:
应用程序文件夹结构问题通过安装最新版本的Angular CLI(1.0.0-rc.1)和重新创建Angular项目(使用
ng new projectname
命令)以及从我的旧项目复制我的TS文件来解决。问题通过安装最新版本的Angular CLI(1.0.0-rc.1)和重新创建Angular项目来解决(使用ng new projectname
命令)并从旧项目复制TS文件
{
"name": "EventRecorder",
"version": "1.0.0",
"description": "QuickStart package.json from the documentation, supplemented with testing support",
"angular-cli": {},
"scripts": {
"build": "tsc -p src/",
"build:watch": "tsc -p src/ -w",
"build:e2e": "tsc -p e2e/",
"serve": "lite-server -c=bs-config.json",
"serve:e2e": "lite-server -c=bs-config.e2e.json",
"prestart": "npm run build",
"start": "concurrently \"npm run build:watch\" \"npm run serve\"",
"pree2e": "npm run build:e2e",
"e2e": "concurrently \"npm run serve:e2e\" \"npm run protractor\" --kill-others --success first",
"preprotractor": "webdriver-manager update",
"protractor": "protractor protractor.config.js",
"pretest": "npm run build",
"test": "concurrently \"npm run build:watch\" \"karma start karma.conf.js\"",
"pretest:once": "npm run build",
"test:once": "karma start karma.conf.js --single-run",
"lint": "tslint ./src/**/*.ts -t verbose"
},
"keywords": [],
"author": "",
"license": "MIT",
"dependencies": {
"@angular/common": "~2.4.0",
"@angular/compiler": "~2.4.0",
"@angular/core": "~2.4.0",
"@angular/forms": "~2.4.0",
"@angular/http": "~2.4.0",
"@angular/platform-browser": "~2.4.0",
"@angular/platform-browser-dynamic": "~2.4.0",
"@angular/router": "~3.4.0",
"angular-in-memory-web-api": "~0.2.4",
"systemjs": "0.19.40",
"core-js": "^2.4.1",
"rxjs": "5.0.1",
"zone.js": "^0.7.4",
"bootstrap": "^3.3.6"
},
"devDependencies": {
"@angular/compiler-cli": "2.2.1",
"concurrently": "^3.2.0",
"lite-server": "^2.2.2",
"typescript": "~2.0.10",
"angular-cli": "1.0.0-beta.21",
"canonical-path": "0.0.2",
"tslint": "^3.15.1",
"lodash": "^4.16.4",
"jasmine-core": "~2.4.1",
"karma": "^1.3.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
"karma-jasmine": "^1.0.2",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~4.0.14",
"rimraf": "^2.5.4",
"ts-node": "1.2.1",
"@types/node": "^6.0.46",
"@types/jasmine": "2.5.36",
"webdriver-manager": "10.2.5"
},
"repository": {}
}