Chilion
Chilion

Reputation: 4490

Grunt error SailsJS when lifting with --no-frontend

I have a Sails Api which the first time boots like a charm. Press CTRL + C to stop it and then try to start it again. It works, BUT,

error: ** Grunt :: An error occurred. **
error: 
------------------------------------------------------------------------
Aborted due to warnings.
Running "clean:dev" (clean) task
Warning: Cannot delete files outside the current working directory. 
------------------------------------------------------------------------

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., `folderthingy` ?
error: 
error:      If you think this might be the case, try running:
error:      sudo chown -R 501 folderthingy

Well, I check it all, and the folder just is my own and has enough rights. I also put up a 777 for testing purposes but this didn't change a thing.

Then, I decided to clear out all the contents of the .tmp folder and try to boot again. This worked like a charm, .tmp got filled again, and when I stopped the server, tried to reboot it, I got the exact same error message again!

I'm booting with the --no-frontend option, so in fact I don't understand why it even wants to load grunt.

Why is this happening? What's going wrong here?

Upvotes: 3

Views: 3734

Answers (5)

Suraj Parise
Suraj Parise

Reputation: 340

Fixed this by following below steps :

File path in your sails app -> tasks/config/sync.js

// 1. Install it as a local dependency of your Sails app:
//    ```
//    $ npm install grunt-sync --save-dev --save-exact
//    ```
//
//
// 2. Then uncomment the following code:
//
// ```
// // Load Grunt plugin from the node_modules/ folder.
// grunt.loadNpmTasks('grunt-sync');
// ```
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Note: Work for Warning "sync:dev" not found

Upvotes: 1

Siyaram Malav
Siyaram Malav

Reputation: 4688

i also got this error-

error: ** Grunt :: An error occurred. **
error: 
------------------------------------------------------------------------
Aborted due to warnings.
Running "sass:dev" (sass) task

    > 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/siyaram.malav/Desktop/repo/project1/.tmp` ?

this error came because it could not find the sass module.And ran following command

sudo gem install sass

it worked for me.

In your case, try running sudo gem install clean command.

it should work. thanks.

Upvotes: 1

Chilion
Chilion

Reputation: 4490

Why it happens is still not known to mankind, but I fixed it with removing the Gruntfile.

Upvotes: 5

shawn cho
shawn cho

Reputation: 1

I had the same problem while following this tutorial: https://www.youtube.com/watch?v=ZE7ye2G_H9Q&index=4&list=PLf8i4fc0zJBzLhOe6FwHpGhBDgqwInJWZ

I created a "linker" folder since that's what the guy did, which then prompted me with the error. It looks like he's using an older version of SailsJS since he runs into no errors.

Did you by any chance create a new folder in the assets folder? If you did, the problem is that grunt isn't able to run tasks on the specific folder since it's not linked with the rest of the assets folders and files. Try placing all newly created files within already existing folders and trying again. This worked for me.

Upvotes: 0

amberv
amberv

Reputation: 251

If you are using Linux, try doing sudo sails lift, you can have problems with permissions (happened to me). If Windows - check that no file manager or some other program is blocking the .tmp folder (also happened to me when I opened the folder in Total Commander). In any case, since you don't use frontend, you can simply remove some of the grunt tasks (in the folder tasks/ you have README.md which explains which tasks are run in which case) or all of them (see documentation) and you won't have the problem.

Upvotes: 1

Related Questions