Sublime Text 3: Build System - node.js. NPM module not executing

Viewed 27889

I'm trying to execute node-dev in a sublime text 3 build system. node-dev is in my path:

cmd node-dev diplay

Yet when I run this build script:

{
  "cmd": ["node-dev", "$file"],
  "selector": "*.js"
}

I get this error, which also shows that npm is in my path.

npm in path img

yet when I run with the same build script using node instead of node-dev it executes just fine.

I've also tried to include the "path" variable pointing at the node-dev bin folder, which didn't help at all.

Any help would be appreciated. Thanks.

5 Answers

For macOS, this worked for me on Sublime Text 3:

{
    "cmd": ["node","$file","$file_base_name"],
    "working_dir": "${project_path:${folder}}",
    "selector":"source.js"
}

Selector Note

My selector setting was:

"selector":"*.js"

and OdatNurd advised that:

The reason is that the selector is not correct; it doesn't match file names, it matches syntax scopes (i.e. it's based on the syntax in use regardless of file extension); changing it to source.js from *.js should get it working.

Related