如何更新ember包?

时间:2017-09-01 08:46:33

标签: node.js ember.js bower

我的旧项目使用Ember 2.8。

现在,我想更新所有软件包,这里是更新的package.json

{
  "name": "php-api-ember-test",
  "version": "0.0.0",
  "description": "Small description for php-api-ember-test goes here",
  "directories": {
    "doc": "doc",
    "test": "tests"
  },
  "scripts": {
    "build": "ember build",
    "start": "ember server",
    "test": "ember test"
  },
  "repository": "",
  "author": "",
  "license": "MIT",
  "devDependencies": {
    "broccoli-asset-rev": "^2.4.5",
    "ember-ajax": "^3.0.0",
    "ember-cli": "~2.14.2",
    "ember-cli-app-version": "^3.0.0",
    "ember-cli-babel": "^6.3.0",
    "ember-cli-bootstrap-4": "^0.3.2",
    "ember-cli-dependency-checker": "^1.3.0",
    "ember-cli-eslint": "^3.0.0",
    "ember-cli-htmlbars": "^2.0.1",
    "ember-cli-htmlbars-inline-precompile": "^0.4.3",
    "ember-cli-inject-live-reload": "^1.4.1",
    "ember-cli-jshint": "^1.0.0",
    "ember-cli-qunit": "^4.1.0",
    "ember-cli-release": "^0.2.9",
    "ember-cli-sass": "5.5.1",
    "ember-cli-sri": "^2.1.0",
    "ember-cli-test-loader": "^1.1.0",
    "ember-cli-uglify": "^1.2.0",
    "ember-data": "~2.14.9",
    "ember-export-application-global": "^2.0.0",
    "ember-load-initializers": "^1.0.0",
    "ember-resolver": "^4.0.0",
    "ember-welcome-page": "^3.0.0",
    "loader.js": "^4.2.3"
  },
  "engines": {
    "node": "^4.5 || 6.* || >= 7.*"
  },
  "private": true
}

这是bower.json

{
  "name": "php-api-ember-test",
  "dependencies": {
    "ember": "~2.14.0",
    "ember-cli-shims": "0.1.1"
  }
}

我删除了 bower_components node_modules 文件夹,然后运行命令npm install && bower install。 安装完成后,我运行ember init并获得此结果。

Missing npm packages:
Package: ember-ajax
  * Specified: ^3.0.0
  * Installed: 2.5.6

Package: ember-cli-app-version
  * Specified: ^3.0.0
  * Installed: 1.0.1

Package: ember-cli-babel
  * Specified: ^6.3.0
  * Installed: 5.2.4

Package: ember-cli-htmlbars
  * Specified: ^2.0.1
  * Installed: 1.3.4

Package: ember-cli-htmlbars-inline-precompile
  * Specified: ^0.4.3
  * Installed: 0.3.13

Package: ember-cli-qunit
  * Specified: ^4.1.0
  * Installed: 2.2.6

Package: ember-export-application-global
  * Specified: ^2.0.0
  * Installed: 1.1.1

Package: ember-load-initializers
  * Specified: ^1.0.0
  * Installed: 0.5.1

Package: ember-resolver
  * Specified: ^4.0.0
  * Installed: 2.1.1

Package: ember-welcome-page
  * Specified: ^3.0.0
  * Installed: 1.0.4

Run `npm install` to install missing dependencies.

An error occured in the constructor for ember-cli-dependency-checker

但我已经多次运行npm install命令了。

如何更新Ember套餐?

3 个答案:

答案 0 :(得分:2)

官方升级文档位于:ember-cli upgrade。详细信息位于release notes

首先,有一些不同的步骤:

  1. 设置全局ember-cli
  2. 升级项目ember版本
  3. 升级所有其他插件
  4. 你应该更好地逐步完成它们。

    顺便说一下,查看您通过的版本的所有发行说明。因为可能存在一些差异。例如,对于旧版本(2.14,2.13 ..),有bower cache cleanbower install步骤。对于新版本(2.15),这些步骤不是必需的。

答案 1 :(得分:1)

不要使用npm。使用纱线。它更快,更安全,并具有更好的缓存。它也被推荐为Bower(Bower)的迁移路径。 Ember团队也推荐纱线代替npm。

rm -rf node_modules
yarn

答案 2 :(得分:0)

使用yarn来选择性地更新软件包

yarn upgrade-interactive --latest