问题描述
当我将 ember-cli
更新为 2.11.0
时,我发现 EMBER NO LONGER SUPPLIED VIA Bower
。所以我检查npm而不是凉亭,但我不知道该怎么办。
When I updated ember-cli
to 2.11.0
and I found EMBER NO LONGER SUPPLIED VIA bower
. So I check npm instead of bower, but I don't know what to do.
如 moment.js
使用凉鞋看起来像:
bower.json
bower.json
"dependencies": {
...
"moment": "2.14.1"
}
ember-cli-build.js
ember-cli-build.js
...
app.import('bower_components/moment/moment.js');
...
.jshintrc
.jshintrc
...
"moment": true,
...
这样可以在帮助
和控制器
中运行。
但是我使用 npm
并设置 ember-cli-build.js
代码 app.import('node_modules / moment / moment.js');
有错误。
But I use npm
and set ember-cli-build.js
code app.import('node_modules/moment/moment.js');
had errors.
和 css
aslo有这个问题。
And css
aslo have this problem.
在ember-cli中,什么是npm而不是bower的最佳方法?谢谢。
What is best way to npm instead of bower in ember-cli? Thanks.
推荐答案
-
通过
npm install ember-browserify --save -dev
npm安装时刻--save-dev
您可以从
you can import it by import moment from 'npm:moment'
- 尝试
- ember包不通过
bower
提供。这并不意味着你根本不能使用凉亭。您仍然可以使用bower.json
,并像您一样添加。 - 您可以在
供应商
文件夹,并包含它ember-cli-build.js
文件。但是对于moment.js的包含。这不是正确的方式。
- Try ember-cli-moment-shim
- ember packages are not served through
bower
. It does not mean you can't use bower at all. You can still usebower.json
and include it like you did. - You can have it in
vendor
folder and include itember-cli-build.js
file . but for moment.js inclusion. this is not the right way.
我更喜欢1或2个选项。在这种情况下,3和4不适用。
I prefer 1 or 2 options. and 3 and 4 is not applicable in this case.
这篇关于更新后ember-cli 2.11.0版本如何以npm代替bower?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!