昨天一切都运行正常,现在当我尝试服务时,我得到了这些错误:
> ./src/main.ts中的错误 模块构建失败:TypeError:无法读取未定义的属性“newLine” at Object.getNewLineCharacter(/Users/leongaban/Projects/TickerTags/wikitags/node_modules/typescript/lib/typescript.js:8062:20)
angular-cli 的全局和本地npm版本为1.0.0-beta.28.3
如何将其升级到.30?我试过了@latest
我的本地package.json:
"devDependencies": {
"@angular/cli": "1.0.0-beta.28.3",
"@angular/compiler-cli": "^2.4.0",
我的全球套餐:
我发现最新版本是beta.32 https://github.com/angular/angular-cli/releases
但是当我运行npm install -g angular-cli@latest
时,它仍会安装.28.3
答案 0 :(得分:2)
在package.json中我改变了:
"devDependencies": {
"@angular/cli": "1.0.0"
要:
"devDependencies": {
"@angular/cli": "1.2.0"
答案 1 :(得分:2)
操作系统:带有Angular 4的Windows
" @ angular / cli":" 1.2.1"
" @ angular / material":" 2.0.0-beta.6"
我刚刚从上面的两个依赖项中删除了插入符号并执行了以下步骤,一切都开始正常运行。
答案 2 :(得分:0)
他们已移至@angular/cli
包名称,以符合其他@angular
模块。为确保您没有留下旧文件,请执行以下步骤:
npm uninstall -g @angular/cli
npm cache clean
npm install -g @angular/cli@latest
然后删除您的本地node_modules
文件夹并执行:
npm install --save-dev @angular/cli@latest
npm install
最新的角度cli版本是.32。升级到较新版本仍然存在问题,但希望在下一次更新时,它们将受到控制。如果没有,请重复我刚才提到的步骤
答案 3 :(得分:0)
对我有用的是:
diff --git a/angular-cli.json b/angular-cli.json
index d74d5d4..2641672 100644
--- a/angular-cli.json
+++ b/angular-cli.json
@@ -1,7 +1,7 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
- "version": "1.0.0-beta.31",
+ "version": "1.0.0-beta.28",
"name": "renaissance"
},
"apps": [
@@ -22,8 +22,8 @@
"styles.less"
],
"scripts": [],
+ "environmentSource": "environments/environment.ts",
"environments": {
- "source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
diff --git a/package.json b/package.json
index b91db8f..7e2b083 100644
--- a/package.json
+++ b/package.json
@@ -12,13 +12,13 @@
},
"private": true,
"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/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.0",
"@ng-bootstrap/ng-bootstrap": "^1.0.0-alpha.20",
"angularfire2": "^2.0.0-beta.8",
@@ -27,15 +27,14 @@
"font-awesome": "^4.7.0",
"moment": "^2.17.1",
"ng2-bootstrap": "^1.3.3",
- "ng2-page-transition": "^0.2.6",
+ "ng2-page-transition": "^1.0.4",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"web-animations-js": "^2.2.2",
"zone.js": "^0.7.2"
},
"devDependencies": {
- "@angular/cli": "1.0.0-beta.31",
- "@angular/compiler-cli": "^2.4.0",
+ "@angular/cli": "^1.0.0-beta.32.3",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"codelyzer": "~2.0.0-beta.1",
@@ -44,8 +43,8 @@
"karma": "1.2.0",
"karma-chrome-launcher": "^2.0.0",
"karma-cli": "^1.0.1",
- "karma-jasmine": "^1.0.2",
"karma-coverage-istanbul-reporter": "^0.2.0",
+ "karma-jasmine": "^1.0.2",
"protractor": "~5.1.0",
"ts-node": "1.2.1",
"tslint": "^4.3.0",
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 1f862c6..b6568b7 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -8,7 +8,7 @@ import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
// App modules/components
import {LayoutsModule} from "./Components/common/layout/layout.module";
import {BlochWidgetsModule} from "./Components/common/widgets/widgets.module";
-import {Ng2PageTransition} from "ng2-page-transition";
+import {Ng2PageTransitionModule} from "ng2-page-transition";
//services
import {PeopleHttpService} from "./Components/common/service/httpPeople.service";
//auth Module
@@ -30,9 +30,9 @@ import {MessagingModule} from "./views/messaging/messaging.module";
@NgModule({
declarations: [
AppComponent,
- Ng2PageTransition,
],
imports: [
+ Ng2PageTransitionModule,
BrowserModule,
FormsModule,
HttpModule,
答案 4 :(得分:0)
这对我有用: -
rm -rf node_modules && npm cache clean && npm uninstall --save angular-cli; npm uninstall -g angular-cli; npm i --save @angular/cli && npm i -g @angular/cli && npm i
rm -rf node_modules /在你的项目中摆脱所有npm的东西然后npm cache clean然后是npm install也应该解决这个问题。另外,请确保cli的本地和全局版本匹配。
答案 5 :(得分:-1)
所以没有任何一个@ angular / cli @ latest为我工作,很可能会在将来的工作中使用。
我有另一个angular2项目ng serve
- 很好。所以我只是从中复制了package.json依赖项并更新了angular-cli.json。
现在再次有效!
"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",
"core-js": "^2.4.1",
"rxjs": "^5.0.1",
"ts-helpers": "^1.1.1",
"zone.js": "^0.7.2"
},
"devDependencies": {
"@angular/cli": "1.0.0-beta.31",
"@angular/compiler-cli": "^2.4.0",
"@types/jasmine": "2.5.38",
"@types/node": "^6.0.42",
"codelyzer": "~2.0.0-beta.1",
"css-loader": "^0.26.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-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "^1.0.2",
"node-sass": "^4.5.0",
"node-sass-import": "^1.1.1",
"protractor": "~5.1.0",
"sass-loader": "^6.0.0",
"source-map-loader": "^0.1.6",
"ts-node": "1.2.1",
"tslint": "^4.3.0",
"typescript": "~2.0.0"
}
必须恢复旧版"source"
键
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
答案 6 :(得分:-1)
在package.json中更新为“@ angular / cli”:“1.0.0-rc.0”“@ angular / compiler-cli”:“2.4.0”并更新文件angular-cli.json下面
变化
"environments": {
"source": "environments/environment.ts",
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
通过
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}