简体   繁体   English

ember-simple-auth和ember-cli

[英]ember-simple-auth with ember-cli

Trying to follow the instructions for using ember-simple-auth with ember-cli here: 尝试按照以下说明将ember-simple-auth与ember-cli结合使用:

http://ember-simple-auth.simplabs.com/ http://ember-simple-auth.simplabs.com/

At the start it says to do : 一开始它说要做:

 npm install --save-dev ember-cli-simple-auth ember generate ember-cli-simple-auth 

But as soon as I try that 'ember generate' I get the following error: 但是,一旦我尝试“生成ember”,就会收到以下错误消息:

The `ember generate` command requires an entity name to be specified. For more details, use `ember help`.

So it looks like that ember generate command isn't right... anyone able to help? 所以看来ember generate命令不正确...任何人都可以提供帮助? Am I to generate an initialiser or something? 我要生成一个初始化程序还是什么?

Thanks 谢谢

Two things were needed to sort this out. 需要解决两件事。

Firstly to upgrade the version of ember-cli 首先升级ember-cli版本

This is covered here: 在这里介绍:

http://www.ember-cli.com/#upgrading-an-ember-cli-app http://www.ember-cli.com/#upgrading-an-ember-cli-app

Use NPM to update to the latest released version of Ember CLI. 使用NPM更新到最新发布的Ember CLI版本。

npm install --save-dev ember-cli npm install --save-dev ember-cli

When you update to the latest version you may need to re-install files from the app blueprint and update Node NPM dependencies. 当您更新到最新版本时,可能需要从应用程序蓝图重新安装文件并更新Node NPM依赖性。

ember init 初始化

This will re-copy files from the project blueprint. 这将从项目蓝图中重新复制文件。 You can choose to overwrite existing files or not. 您可以选择是否覆盖现有文件。 It will subsequently call npm install to update any changed dependencies. 随后它将调用npm install更新任何已更改的依赖项。

And Secondly , needed to find the updated blog instructions for ember-simple-auth: 其次 ,需要查找关于ember-simple-auth的更新的博客说明:

http://log.simplabs.com/post/90339547725/using-ember-simple-auth-with-ember-cli http://log.simplabs.com/post/90339547725/using-ember-simple-auth-with-ember-cli

which don't include the generate command now. 现在不包含generate命令。

Typically the blueprints the generators use, require the following syntax: ember generate <blueprint> <name> 通常,生成器使用的蓝图需要以下语法: ember generate <blueprint> <name>

I would expect the usage of simple-auth to follow the convention and you would do something like 我希望使用simple-auth遵循约定,并且您会做类似的事情

ember generate ember-cli-simple-auth <your new route name>

Ember simple auth and ember cli simple auth are two slightly different things. Ember简单身份验证和ember cli简单身份验证是两个稍有不同的东西。 On the ember simple auth page https://github.com/simplabs/ember-simple-auth#ember-cli it says 在ember简单身份验证页面https://github.com/simplabs/ember-simple-auth#ember-cli上说

If you're using Ember CLI, just add the ember-cli-simple-auth Ember CLI Addon to your project and Ember Simple Auth will setup itself. 如果您使用的是Ember CLI,只需将ember-cli-simple-auth Ember CLI插件添加到您的项目中,Ember Simple Auth将自行设置。

which means to do what you are doing you need the ember-cli-simple-auth add on - found here https://github.com/simplabs/ember-cli-simple-auth 这意味着要做您正在做的事情,您需要添加ember-cli-simple-auth-在此处找到https://github.com/simplabs/ember-cli-simple-auth

The way to install that is how youve described above. 安装方法就是您上述的方法。

Ember simple auth has gone through a lot of changes in its time so the page you are getting your instructions from might not be the most up to date. Ember简单认证在时间上经历了很多变化,因此您正在获取指示的页面可能不是最新的。 Github is usually the best place to check for solutions to packages if you are having difficulties as the most up to date documentation will most liekly be there. 如果您遇到困难,Github通常是检查软件包解决方案的最佳场所,因为最新文档最容易出现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM