Tag: sails.js

sails-auth生成器不起作用

我想使用sails-auth在我的Sails应用程序上设置社交身份validation,但是我的生成器不起作用。 在这里我的.sailsrc { "generators": { "modules": { "auth-api": "sails-auth" } }} 在terminalsails generate auth-api像文档,这是错误No generator called auth-api found; perhaps you meant found; perhaps you meant sails生成api auth-api?` 感谢所有

帆js,如何发送背景事件到手机

嗨,我们正在开发移动应用程序,并希望发送一些事件触发器移动表单风帆JS移动。 我们有rest服务暴露在手机正在消费的风帆。 是否有可能从sails发送一些事件到移动和android应用程序做一些处理获取这些事件..

如何在AfterCreate中访问请求对象 – waterline,sails

我有2个模型Newspaper.js和Reader.js // Newspaper module.exports = { attributes: { title: { type: 'string' }, } }; 和读者 //Reader module.exports = { attributes: { // In case if the message is poll, it has options field which enumerates choices. title: { type: 'string' }, } }; 而一个模型来存储它们之间的多对多关系 module.exports = { attributes: { newsPaper: { model: 'newsPaper' }, […]

无效的属性发送到Passport错误桶风帆

我正在申请帆。 我正在使用桶将数据填充到我的模型中。 填充用户后填充护照时出现以下错误。 以下是我的user.json和passport.json [ { "communityID": 1, "email": "testuser@getintuch.com", "ownershipGroups": [1], "membershipGroups": [1] } ] [ { "protocol": "local", "password": "random", "accessToken": "random", "user": 1 } ] barrels.populate(['user'], function (err) { if (err) return done(err); barrels.populate(['passport'], function (err) { if (err) return done(err); done(err, sails); }); }); 以下是我得到的错误 Error (E_VALIDATION) :: 1 attribute is […]

尝试在sails.js上更新()模型时出错

正如你将在下面的代码中看到,我能find用户,因为我得到了console.log('log1',userSettings.PASSWORD); 打印在terminal,我得到一个user.Settings.PASSWORD返回。 所以到目前为止,一切正常。 但是,当我试图做更新我最终得到错误: 我得到以下错误:详细信息:RequestError:无效的列名'id' 这是我的代码的样子: updateSettings: function(params) { var Promise = require('bluebird'); return new Promise(function(fullfill, reject) { sails.models.customer.findOne() .where({ USERNAME: params.username, PASSWORD: params.currentPassword }).exec(function(err, userSettings) { if (err) { reject(new Error('Error finding user')); console.error(err); }else if (userSettings) { console.log('log1', userSettings.PASSWORD); sails.models.customer.update({ USERNAME: params.username }, { PASSWORD: params.newPassword }).exec(function(err, userSettingsUpdated) { if (err) { console.error(err); […]

Node.js内存错误致命错误:无效的数组长度分配失败 – 进程内存不足

我使用风帆0.10.5运行sails.js实例。 我在内存中存储了一些对象。 我经常遇到以下错误: 致命错误:无效数组长度分配失败 – 进程内存不足。 似乎有人遇到这个,并报告说这是在node.js v0.11.15中引入的 。 据我所知,这仍然是一个悬而未决的问题。 为了避免这种情况,我安装了节点v0.11.14并运行了v0.10.5。 但是,这个问题依然存在。 有人能告诉我,当这个错误发生在节点,并指出我如何能避免它的方向?

当应用程序在生产环境中运行时,在sails.js中上传后不会立即加载图像

我已经上传和存储在/资产/图像/path/到/图像的图像。 开发环境一切都很好。 但是当我在生产环境中运行我的应用程序时,首先出现上传后图片不能立即显示的问题。 但是可以通过帆升降机重新启动服务器后查看图像。 我search的解决scheme,并得到了想法复制相同的上传文件在/.tmp文件夹立即访问上传的图像。 所以我尝试这个解决scheme,并使用下面的代码来复制.tmp文件夹中的图像… var tempLocation = process.cwd()+ '/.tmp/public/images/custom/path/to/image'; fs.createReadStream(uploadLocation).pipe(fs.createWriteStream(tempLocation)); 但是,当我在.tmp中写入时出现错误 events.js:72 throw er; // Unhandled 'error' event ^ Error: ENOENT, open path/to/.tmp/folder; 我在全球和本地都安装了grunt。 所以不要认为这是一个问题。 请帮我解决这个问题。 谢谢

无法从云AMQP队列中获取消息

嗨,我想在我的帆应用程序中使用rabbitmq。 当我试图发布数据后,我的模型给连接适配器我可以看到我的兔子队列中收到的数据,但数据库尚未创build。 我使用mongo数据库作为我的模型,sails-rabbitmq作为我的node_module我引用了这个链接 npm install sails-rabbitmq 连接适配器是 – rabbitCluster: { adapter: 'sails-rabbitmq', //my amqp rabbitmq installation url url: 'amqp://localhost', }, MongoDB: { adapter: 'sails-mongo', host: 'localhost', port: 27017, user: '', password: '', database: 'myTest' } 在我的模型里面指定了连接如下 connection : ['rabbitCluster','MongoDB'] //in my config/rabbitmq.js file module.exports.rabbitmq = { pkFormat: 'string' }; 据我所知,我们不需要编写创build和更新控制器方法,它应该与sails提供的默认CRUD操作。 但是当我尝试创build数据库条目时,我没有得到任何回应。

在生产模式下的帆升降机不起作用

当我尝试使用sails lift –prod升降帆提升帆应用程序 – 它在production.js文件中给出错误。 说Warning: Uglification failed. Unexpected character '#'. Line 12432 in .tmp/public/concat/production.js Warning: Uglification failed. Unexpected character '#'. Line 12432 in .tmp/public/concat/production.js 我search,发现它来自我的资产的js文件 #!/usr/bin/env node 当我删除这条线,并尝试做帆升降机 – 它得到的stucks 不知道错误是什么。 谁能帮我?

用摩卡回收的sails.js

我有某些摩卡testing需要重新提升使用moduleLoaderOverride模拟某些策略的不同configuration的sails。 一般来说,这是工作,但似乎帆不降低和重新正确提升。 为testing执行sails实例所有pipe理的实用程序文件: // util var Sails = require('sails/lib/app'), sails; module.exports = { sailsInstance: undefined, testConfigs: {}, start: function(callback) { this.sailsInstance = new Sails(); /* This config will NOT be enforced for the remaining tests, it is just a quick lift so our code can use sails config parser and extract the other configs easily. […]