Sublime Forum

Problem for building/running node.js code

#1

I added a build system

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

named Node.sublime.build, then impossible to build a js file (with just console.log(1) ) with Tools>Build or ctrl+b

It always say: “No Build system”

I tried restarting sublime (system: windows 10, node 5.6 working fine in windows terminal)

sublime 3 build 3013, on sublime 2 the build button isn’t enabled when doing the same things than above

link on the issue on gh: https://github.com/SublimeTextIssues/Core/issues/1107

0 Likes

#2

The selector should be source.js.

0 Likes

#3

thanks indeed :slightly_smiling:

also I noticed I had a Node and Nodejs build systems, I move the Node.sublime-build out of his repo, and only Nodejs build system remains. I tried building with this one, and I have this error:

 The specified file path is not found
[Finished in 0.1s with exit code 1]
[cmd: ['taskkill /F /IM node.exe & node', 'C:\\Users\\admin\\dev\\test\\build.js']]
[dir: C:\Users\admin\dev\test]
[path: C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Users\admin\AppData\Roaming\npm]

but the path are all correct, and node.exe is running fine in terminal, I’m putting back the custom Node.sublime-build, interested to know what’s wrong, thanks again

0 Likes

#4

I believe ST treat 'taskkill /F /IM node.exe & node' as a filename. However, I don’t know how to resolve it. I had a problem using & in a cmd parameter.

0 Likes

#5

shell_cmd needs to be used for that. Basically, everything that goes beyond simply launching a program with parameters must be a shell_cmd.

0 Likes

#6

this must work, but aside this, you may be better using something like nodemon or foreman …

0 Likes

#7

or pm2

ok for shell_cmd, thanks ^

0 Likes