Search code examples
javascriptnode.jsbuildsublimetext3

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


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.


Solution

  • Sublime text docs:

    https://www.sublimetext.com/docs/build_systems.html

    shell

    Optional. If true, cmd will be run through the shell (cmd.exe, bash…)

    Try to add "shell : true

    {
      "cmd": ["node-dev", "$file"],
      "selector": "source.js",
      "windows" : {
         "shell": true
      }
    }