- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我尝试使用 CoffeeScript 和 ES6 创建 sails.js 项目首先,我使用 sails new 'appName'和npm 安装 CoffeeScript --savenpm 安装 babel --save
并修改app.js
options = {
loose : "all",
stage : 1,
ignore : null,
only : null,
extensions: null
};
require("sails-hook-babel/node_modules/babel/register")(options);
但是有点不对
我看到其他人可以自动创建它(它可以创建app.coffee local.coffee ...等不需要修改)如何做到这一点?
-----------------------------------------------
error: ** Grunt :: An error occurred. **
error:
------------------------------------------------------------------------
Warning: Task "watch" not found.
Aborted due to warnings.
------------------------------------------------------------------------
error: Looks like a Grunt error occurred--
error: Please fix it, then **restart Sails** to continue running tasks (e.g. watching for changes in assets)
error: Or if you're stuck, check out the troubleshooting tips below.
error: Troubleshooting tips:
error:
error: *-> Are "grunt" and related grunt task modules installed locally? Run `npm install` if you're not sure.
error:
error: *-> You might have a malformed LESS, SASS, CoffeeScript file, etc.
error:
error: *-> Or maybe you don't have permissions to access the `.tmp` directory?
error: e.g., `/Users/yangjunzhang/Documents/workspace/burstWork/.tmp` ?
error:
error: If you think this might be the case, try running:
error: sudo chown -R 501 /Users/yangjunzhang/Documents/workspace/burstWork/.tmp
最佳答案
最好将 babel
包用作独立包,而不是来自 sails-hook-babel
。我的集成流程如下所示:
1)安装babel-cli
和babel-preset-es2015
:
npm install --save babel-cli babel-preset-es2015
2) 使用以下脚本更改您的 package.json
文件的 scripts
部分:
"scripts": {
"start": "babel-node --presets es2015 app.js"
}
3) 使用 npm start
脚本启动您的应用程序:
npm start
之后,您可以使用 ES6 语法编写所有代码,并使用 npm start
启动项目。
关于javascript - 如何使用 coffeescript 和 ES6 创建 sails.js 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33508081/
根据文档,sails lift 将始终尝试使用本地安装的 Sails 模块(即 app/node_modules/sails)运行您的应用。 但是当我运行 sails console 时,我可以从堆栈
在我的sails.js我正在尝试关闭服务和模型的默认全局变量,如下所示: sails: true, services: false, models: false 作为一种风格偏好,我想明确使用 sai
我正在用 sails 框架编写一些 api。我有一个 api 需要从两个表中获取数据,所以我想使用这样的 sql 查询: select * from table1 union select * fro
根据 this , 在创建与其他记录关联的新记录时,响应应包含填充的关联记录。 POST /pony { "name": "Pinkie Pie", "pet": 1 } 响应应该是这样的 {
我已经开始从事一个项目,并决定使用 Sails.js 构建 API。我以前没有使用 Sails 的经验,这就是为什么我需要您的推荐。 我需要为许多模型实现行级权限。例如,假设我只想允许对该记录的创建者
我在一个使用 sail.js 的项目中工作,一切正常,但每次我修改某些内容时,我都必须重新启动“sails lift”。是否没有一个选项可以让我在服务器在线时工作并查看我所做的所有更改? 据了解,问题
当sails.js 模块上的电子邮件验证规则失败时,服务器正在崩溃。 这是我的模块的片段: //用户的电子邮件地址 email: { type: 'string', email: true,
我正在尝试在客户端使用 Sails.js 和 sails.io.js 创建一对一聊天。 我可以让 io.socket.get 和 io.socket.post 工作,但是我无法从任何一个 收到任何东西
我刚刚开始使用 Sails.js,它是一个了不起的框架。但是我遇到了一些情况,我找不到谷歌的解决方案,所以我来这里寻求帮助。 我有一个 Controller 连接到另一个远程服务,该服务使用非常旧的
我已经使用 npm install sails -g 成功安装了 sails我运行的是 Windows 7。当我尝试运行“sails”命令时,收到错误消息“找不到命令”。然后我将相应的 bin 文件夹
我正在使用带有船长-s3适配器的船长来处理我的 sails 应用程序中的文件上传。 当文件正常发送时它工作正常,但是当请求中止时我收到未处理的错误消息并且 sails 崩溃。 events.js:85
像 Rails 一样,有什么方法可以向验证器添加自定义错误消息吗? 喜欢: if(this.password != this.passwordConfirmation){ this.errors
我已经使用 npm install sails -g 成功安装了 sails我运行的是 Windows 7。当我尝试运行“sails”命令时,收到错误消息“找不到命令”。然后我将相应的 bin 文件夹
我需要查询关联表(由 sails 创建),所以我不能使用“Model.query”,因为我没有这个表的模型。我找不到解决方案。谢谢 最佳答案 您可以使用其他模型对象,例如 User.query(sql
仅当满足某些条件时,我才需要加密密码。 beforeUpdate: function (value, cb) { User.findOne(value.id) .exec(function (er
在我的风帆应用程序中,我按如下方式编辑 config/models.js 文件以在提升应用程序时清理数据库。 migrate: 'drop', connection: 'mongodb' 但是
我将sails 升级到@^1.0.0 版本,在开发API 时,我想使用Service,但Sails 文档建议现在使用Helper。而且我并没有真正习惯于使用新的方法来识别助手、构建脚本或 Action
我试图弄清楚如何禁用 Sails.js 中模型的自动数据库迁移。 我知道你可以设置migrate: 'safe'在模型中,但是有没有办法为所有模型指定这个? 最佳答案 实际上,有办法做到这一点。 OR
我正在开始一个新项目,我想使用 AngularJS 作为前端,使用 SailsJS 作为后端。我需要为不同的客户分离数据库。因此,每个客户端都必须有自己的数据库。 我没有找到如何在帆和水线中制作这个。
我从 SailsJS 开始和 MySQL ,我的数据库中有很多表。所以,我不知道 SailsJS有一个工具可以从数据库中生成模型,比如 Database First在 Entity Framework
我是一名优秀的程序员,十分优秀!