我正在尝试将Angular2更新为最新版本候选版本4。
我已经执行了 npm过时的并相应地编辑了package.json文件。 然后我执行了失败的 npm update 。我没有保存错误消息。在下面我用Google搜索并尝试了几个不同的npm命令。不幸的是我不记得了。
当前状态是 npm update 没有显示任何内容;所以似乎工作。 命令 npm start 启动服务器,但浏览器控制台显示多个错误。第一个是:
http://localhost:3000/node_modules/@angular/platform-browser-dynamic/platform-browser-dynamic.umd.js Failed to load resource: the server responded with a status of 404 (Not Found)
除 npm install 外,还显示以下警告:
typings WARN deprecated 2016-06-02: "registry:dt/core-js#0.0.0+20160317120654" is deprecated (updated, replaced or removed)
typings WARN deprecated 2016-06-22: "registry:dt/node#4.0.0+20160509154515" is deprecated (updated, replaced or removed)
typings WARN deprecated 2016-06-22: "registry:dt/jasmine#2.2.0+20160505161446" is deprecated (updated, replaced or removed)
├── core-js (global)
├── jasmine (global)
└── node (global)
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12
npm WARN optional Skipping failed optional dependency /lite-server/browser-sync/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.12
npm WARN @angular/core@2.0.0-rc.4 requires a peer of rxjs@5.0.0-beta.6 but none was installed.
npm WARN @angular/http@2.0.0-rc.4 requires a peer of rxjs@5.0.0-beta.6 but none was installed.
npm WARN @angular/router@3.0.0-beta.2 requires a peer of rxjs@5.0.0-beta.6 but none was installed.
npm WARN @angular/router-deprecated@2.0.0-rc.1 requires a peer of @angular/core@2.0.0-rc.1 but none was installed.
npm WARN @angular/router-deprecated@2.0.0-rc.1 requires a peer of @angular/common@2.0.0-rc.1 but none was installed.
npm WARN @angular/router-deprecated@2.0.0-rc.1 requires a peer of @angular/platform-browser@2.0.0-rc.1 but none was installed.
npm WARN angular2-in-memory-web-api@0.0.14 requires a peer of rxjs@5.0.0-beta.6 but none was installed.
package.json相关部分目前是:
"dependencies": {
"@angular/common": "2.0.0-rc.4",
"@angular/compiler": "2.0.0-rc.4",
"@angular/core": "2.0.0-rc.4",
"@angular/http": "2.0.0-rc.4",
"@angular/platform-browser": "2.0.0-rc.4",
"@angular/platform-browser-dynamic": "2.0.0-rc.4",
"@angular/router": "3.0.0-beta.2",
"@angular/upgrade": "2.0.0-rc.4",
"angular2-in-memory-web-api": "0.0.14",
"angular2-uuid": "^1.0.7",
"bootstrap": "^3.3.6",
"core-js": "^2.4.0",
"reflect-metadata": "^0.1.3",
"rxjs": "5.0.0-beta.9",
"systemjs": "0.19.31",
"zone.js": "^0.6.12"
},
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings": "^1.0.4",
"canonical-path": "0.0.2",
"http-server": "^0.9.0",
"tslint": "^3.7.4",
"lodash": "^4.11.1",
"jasmine-core": "~2.4.1",
"karma": "^1.1.0",
"karma-chrome-launcher": "^1.0.1",
"karma-cli": "^1.0.1",
"karma-htmlfile-reporter": "^0.3.4",
"karma-jasmine": "^1.0.2",
"protractor": "^3.3.0",
"rimraf": "^2.5.2"
},
答案 0 :(得分:4)
请按照以下步骤操作:
删除node_modules文件夹。
运行'npm install'命令。
答案 1 :(得分:1)
在typings.json中,必须更新到新的注册表值,如果问题出现在core-js
“core-js”:“registry:dt / core-js#0.0.0 + 20160317120654”
到
“core-js”:“registry:dt / core-js#0.0.0 + 20160725163759”
https://github.com/mgechev/angular2-seed/commit/8a8c64e0e8b18cd0c19c1ab2f1dc71a30bbd6174
答案 2 :(得分:1)
这可能已经过时,但您的打字从未得到解决。鉴于您希望始终保持最新状态。还有其他任何想要了解更新过程的人
以下是更新/重新安装的方法
实施例: 要让节点更新,只需输入
即可typings install dt~node --save --global
以下内容将更新/typings/global/node
如果您没有节点,则相同的命令就足够了,您的index.d.ts
也将使用新条目进行更新!