Vadorequest
Vadorequest

Reputation: 17997

Sails.js - How to use forever and not start grunt automatically on server start?

I'm running into an issue using Sails.js framework (node.js).

It seems like it runs automatically grunt when the server starts. But I don't want that. In order to prevent this, it is possible to configure in a .sailsrc file that we don't want grunt to start. (http://www.sailsjs.org/documentation/concepts/assets/disabling-grunt)

But this specific configuration file is only taken into account when we run the server using sails lift command. It won't be used if we use node app.js.

Point is, I want to use forever with sails. But I don't know how to run forever and take into account the .sailsrc file so that Sails doesn't start grunt on its own.

I'm using BrowserSync and I need to startup things in a really specific order, it works fine when using sails lift and grunt separately, but I don't get any hot refresh that way.

I found a similar issue here, but it doesn't help me much. Error when use forever in sails

Upvotes: 2

Views: 753

Answers (3)

Cristian Torres
Cristian Torres

Reputation: 206

Setting hooks.grunt = false keeps being valid for Sails v1.x

Upvotes: 0

coagmano
coagmano

Reputation: 5671

In the sails book from Manning:

Note: Grunt is also optional. If for some reason you enjoy doing manual repetitive tasks simply delete the Gruntfile.js from the root of your project. No more Grunt. When you restart Sails via sails lift warnings that the “Gruntfile could not be found” and that “no grunt tasks will be run” are displayed.

Give that a shot

Upvotes: 1

piscator
piscator

Reputation: 8709

I assume you get the "Your .sailsrc file(s) will be ignored." error.

Running npm install rc --save in both the project root directory and node_modules/sails, and adding

"hooks": {
    "grunt": false
 }

to .sailsrc solved this issue for me.

Update: if you're using an older version of Sails, such as [email protected] you have to change the line "rc": "^0.5.5” to "rc": "^0.5.0" in node_modules/sails/package.json, remove rc and reinstall it with the older version of rc (which is used in the newer versions of Sails).

Upvotes: 4

Related Questions