sails: Node 10 issue: Warning: Task "sync:dev" not found, when updating any *.less file in styles folder

The problem is that I can’t use styles for my application, because any modifications to *.less files cause grunt to fail. Here is what I’ve got in the terminal:

debug: -------------------------------------------------------
error: ** Grunt :: An error occurred. **
error: 
------------------------------------------------------------------------
Aborted due to warnings.
Running "watch" task
Waiting...
>> File "assets/styles/importer.less" changed.
Loading "sync.js" tasks...ERROR
>> TypeError: Cannot read property 'length' of undefined
Warning: Task "sync:dev" not found. 
------------------------------------------------------------------------

error: Looks like a Grunt error occurred--
error: Please fix it, then **restart Sails** to resume watching for changes to assets:
error:      CTRL+C, then `sails lift`
error: Or if you're stuck, check out the troubleshooting tips below.

error: Troubleshooting tips:
error: 
error:  *-> Are "grunt" and any custom Grunt plugins you're using installed in this project?
error:      Run `npm install` if you're not sure.
error: 
error:  *-> You might have a typo in one of your LESS files, etc.
error: 
error:  *-> Or maybe you don't have permissions to access the `.tmp` directory?
error:      e.g., `/home/user18/Projects/test/t1/.tmp` ?
error: 
error:      If you think this might be the case, try running:
error:      sudo chown -R 1000 /home/user18/Projects/test/t1/.tmp
error: 
error:  *-> If you're still unsure, drop by https://sailsjs.com/support.

Sails version: v1.0.2 Node version: v10.10.0 NPM version: v6.4.1 DB adapter name: N/A DB adapter version: N/A Operating system: Ubuntu 18.04.1 LTS


Steps to reproduce:

  1. npm install -g sails
  2. sails new t1 (choose any option)
  3. cd ./t1
  4. sails lift
  5. touch ./assets/styles/importer.less

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Comments: 20 (5 by maintainers)

Most upvoted comments

try:

  • npm install grunt-sync --save-dev --save-exact
  • npm install ajv --save-dev --save-exact
  • uncommenting these lines // // Load Grunt plugin from the node_modules/ folder. // grunt.loadNpmTasks('grunt-sync'); from the ./tasks/config/sync.js hopefully, it will fix this problem

@firmangpi I only needed to uncomment grunt.loadNpmTasks('grunt-sync'); and install grunt-sync locally. That seems to fix the issue if you’re using Node v10.x.x, and don’t want to downgrade to v8.

I’m currently using v10.15.1

I’ll look into it- haven’t done a lot of node 10 testing yet since node 8 is still officially supported for a while yet.

Oh I think this is a grunt error right? Maybe Im not seeing this error because I got rid of grunt.

On Thu, Jun 27, 2019 at 3:19 PM Rachael Shaw notifications@github.com wrote:

Just tested this out with the latest version of Sails and Node 10, and still seeing an error from sync:dev (although a slightly different one now):


Aborted due to warnings. Running “sync:dev” (sync) task Warning: Cannot read property ‘bigint’ of undefined

Will keep looking into this.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/balderdashy/sails/issues/4513?email_source=notifications&email_token=ABQTZCLBPZMVQ32PXTU5XI3P4U4IBA5CNFSM4FVD4HS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODYYRAFI#issuecomment-506531861, or mute the thread https://github.com/notifications/unsubscribe-auth/ABQTZCOIKC5KZKTA2WZLAFDP4U4IBANCNFSM4FVD4HSQ .

@viachbiryuk @Noitidart @johnabrams7 actually, once I started looking at it again I realized that my test app had been generated with an older version of Sails after all. (My install of the latest sails wasn’t as global as I thought, and when I did sails -v I got 1.0.0-3 which was way before sails-hook-grunt was updated.)

Tried this again with a new app, and triple-checked my versions of Node.js + Sails.js, and couldn’t reproduce the issue anymore. Looks like this is fixed now! ✨

@viachbiryuk any new apps you generate should be fine with Node 10 from now on, but if you update sails-hook-grunt in an existing app, be aware that it’s on a new major version and you’ll need to get rid of any references to the jst and coffee tasks, as those are no longer included by default (unless you are using those, in which case you’ll need to install grunt-contrib-jst and grunt-contrib-coffee separately).

@danielfeelfine @firmangpi Thanks it worked but only in local and staging, not in production mode.

Is there any further step to fix that in production as well ? Thanks

Apparently, this issue is still there with 10.13.0

More background here

I have downgraded nodejs version to 8.12.0 and the issue disappeared 😉