gruntjs / grunt-contrib-watch

Run tasks whenever watched files change.
http://gruntjs.com/
MIT License
1.98k stars 356 forks source link

Grunt watch doesn't work #561

Closed pinglinh closed 5 years ago

pinglinh commented 5 years ago

Tried running grunt watch but it gives me the following error:

grunt[58526]: ../src/node_contextify.cc:627:static void node::contextify::ContextifyScript::New(const FunctionCallbackInfo<v8::Value> &): Assertion `args[1]->IsString()' failed.
 1: 0x10005eeab node::Abort() [/usr/local/bin/node]
 2: 0x10005ede8 node::PrintErrorString(char const*, ...) [/usr/local/bin/node]
 3: 0x10005cda3 node::contextify::ContextifyScript::New(v8::FunctionCallbackInfo<v8::Value> const&) [/usr/local/bin/node]
 4: 0x1001d4f3a v8::internal::FunctionCallbackArguments::Call(v8::internal::CallHandlerInfo*) [/usr/local/bin/node]
 5: 0x1001d42fe v8::internal::MaybeHandle<v8::internal::Object> v8::internal::(anonymous namespace)::HandleApiCallHelper<true>(v8::internal::Isolate*, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::HeapObject>, v8::internal::Handle<v8::internal::FunctionTemplateInfo>, v8::internal::Handle<v8::internal::Object>, v8::internal::BuiltinArguments) [/usr/local/bin/node]
 6: 0x1001d3d97 v8::internal::Builtin_Impl_HandleApiCall(v8::internal::BuiltinArguments, v8::internal::Isolate*) [/usr/local/bin/node]
 7: 0x163f5a24fb7d 
 8: 0x163f5a209e66 
 9: 0x163f5a28abc0 
Abort trap: 6

Currently I have grunt-cli@1.3.2 and node@11.3.0 installed globally.

These are the local dev dependencies installed in my project which I am trying to run grunt watch from:

    "grunt": "^1.0.1",
    "grunt-contrib-clean": "^1.0.0",
    "grunt-contrib-jshint": "^1.1.0",
    "grunt-contrib-requirejs": "^1.0.0",
    "grunt-contrib-sass": "^1.0.0",
    "grunt-contrib-watch": "^1.1.0",
    "grunt-grunticon": "^2.3.1",
    "grunt-includes": "^1.0.0",
    "grunt-sass": "^2.1.0",

The watch task in my Gruntfile.js is like so:

    watch: {
      files: [
        "js/**/*.js",
        "styles/**/*.scss",
        "templates/**/*.html",
        "templates/**/**/*.html"
      ],
      tasks: ["default"]
    },
...
grunt.loadNpmTasks("grunt-contrib-watch");
...
grunt.registerTask("default", ["build"]);

Ignore the ... as I didn't want to show non-relevant code.

This setup worked for me couple of months back. but it doesn't anymore. Any help would be greatly appreciated! 😄

pinglinh commented 5 years ago

Nvm, my node version was 11.0.0 which wasn't compatible. I installed it to 8.1.0 and grunt watch works again! 😅