ember.js 如何更新ember包?

yqlxgs2m  于 2022-11-05  发布在  其他
关注(0)|答案(3)|浏览(268)

我有我的老项目,使用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_componentsnode_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软件包?

vaj7vani

vaj7vani1#

不要使用npm。使用yarn。它更快,更安全,有更好的缓存。它也被推荐作为从Bower(由Bower)的迁移路径。Yarn也被Ember团队推荐,而不是npm。

rm -rf node_modules
yarn
kmbjn2e3

kmbjn2e32#

使用yarn进行选择性软件包更新

yarn upgrade-interactive --latest
vsmadaxz

vsmadaxz3#

官方升级文档位于:ember-cli upgrade。详细信息位于release notes中。
首先,有一些明显的步骤:
1.设置全局ember-cli
1.正在升级项目ember版本
1.正在升级所有其他附加元件
你最好一步一步地做。
顺便说一句,看看你已经通过的所有版本的发行说明。因为可能会有一些不同。例如,对于旧版本(2.14,2.13..)有bower cache cleanbower install步骤。对于新版本(2.15),这些步骤是不必要的。

相关问题