Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Pavel Shabardin
yes, there is no such methods
Why not just use native stream?
Pavel Shabardin
because sails already have nice stream abstraction for find() maybe there is a same for sendNativeQuery exist?
Marco Romano
npm ERR! Linux 4.4.0-77-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "bcrypt" "--save"
npm ERR! node v4.2.6
npm ERR! npm  v3.5.2

npm ERR! bcrypt@1.0.3 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 7
npm ERR! 
npm ERR! Failed at the bcrypt@1.0.3 install script 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the bcrypt package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs bcrypt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls bcrypt
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /root/smash_node/npm-debug.log
Hi, try install bcrypt on my machine linux and I have this error. On my pc works, but on server no...
I have node 4.x, and on my pc 9.x. It is possible that the problem it is?
Dean Hantzis

couple interesting things I've noticed with Sails 1.0 today:

  1. model attribute unique:true does not work with mongodb v3.2. It creates an index, but does not set it as unique
module.exports = {
  migrate: 'alter',
  attributes: {
    eventId: {
      type: 'number',
      unique: true

My current solution is to ensureIndex in bootstrap.js and remove attribute unique:true on model attr

  await Event.native(function(err, collection) {
    collection.ensureIndex({eventId: 1}, {unique: true});
  1. sails run [scriptName] does not execute bootstrap.js (intended functionality?)

  2. createEach() .tolerate('E_UNIQUE') (sails-mongo, mongodb v3.2) will stop creating the following records once tolerate unique is triggered. So if 10 records to createEach, and E_UNIQUE triggers at idx 5, idx > 5 will be skipped due to db server error. My attempt to brute force createEach without checking for uniqueness in DB is for a high performance ETL process. I know this is hack-ish, but I don't believe there is support for something like MYSQL's multi-row REPLACE INTO or MONGO find/upsert. I should probably go native for this...

My guess is that only #1 is a bug and #2/#3 are expected behavior. @mikermcneil @particlebanana I can file a bug for #1 if you'd like. Let me know what you think of #2 and #3 if you have a min. THX

Ayan Banerjee
@maczor I want to use express like virtual routes for my case. Like this app.use('/original/images', express.static(path.join(__dirname, 'uploads/image')));
Any solution for it???
Marco Romano
Hi, I write also on nodejs gitter, but I write also here, and I hope that someone can help me
I have a problem very big with node js
I have a server on https that started with nodejs 4.2.6 with pm2 and all works. Now i can start another project on another path on same port always on https, but use bcrypt and with nodejs 4.x doesn't works, and old project started with pm with version 8.x doesn't work. This project it is on sails js. The goal is migrate all api express on sails, but initially I want both server on execution and migration by step. Can I resolve this problem? Start 2 server on same port but different path, and problem with version of nodejs
Thomas Lepérou
@marcorom88_twitter uhm. You cannot serve twice on the same port. This is a system/network constraint
For bcrypt, be sure to compile with the version of nodeJs you're trying to work with.
now, if you want to keep the same https://URL:port and route requests either to ex-express or new Sails, you should set up a proxy like Nginx
@zimudec Did you manage to find a simple example of an implementation of a Vue router with parasails?
Hello need help
I am new to Sails and trying the find method from console and getting this error
sails> const object = Category.find({id: 1})
sails> object
how to see the object contents
can someone help me with this?
even in controller when I try to access model I am getting the syntax error const category = await Category.find({id: 1});
const category = await Category.find({id: 1});
showing me this error
    const category = await Category.find({id: 1})
SyntaxError: Unexpected identifier
Can anyone point me to a simple example of using the Vue router with parasailsjs? I could not find a lot of documentation on this.
@bramu_twitter did you put the async keyword before the function ? async function(..) { ..... }
Thomas Lepérou
@iamlennym do you mean like this one? https://github.com/ndabAP/vue-sails-example
Marco Romano
@tleperou with apache is possible if here on path different... I want start 2 server on https with same port for mantain same endpoint for continue working on app. Exist an alternative?
If app call domain.com/user and now with new server call domain.com:81/user, on app will not works
I found some about nginx, I try this solution
@hamzaOp I have added that but still error seems coming
@bramu_twitter same error ? can you give a snippet of the code ?
all: async function(req, res) {
const category = await Category.find({id: 1});
return res.view('categories/all', {name: category.name});
this is all I am doing but when I try from console also its throwing the error
@bramu_twitter what version of node are you running?
node -v
is it issue with node version
no, it shouldn't be
it could be if you were using node < 6, but 8 should be ok
I can't say if console should work with async/await, but your controller definitely should
@bramu_twitter I’ve had a similar issue - I had an issue with node running an older version
any work around can suggest I am unable to start the first, any sample project from where I can check the code?
try nvm ls
paste what is output
if it’s not using the version you need .. use nvm use x.x
It’s odd - always runs that version in vs code but a separate terminal runs everything fine - it’s not a huge issue
you can nvm default x.x.x
sorry… nvm alias default x.x.x