Sublime Text 3: Node.JS Build System - node.js

I'm trying to make a Node.js build system for SB3 on Mac Yosemite. Here is my Node.Sublime-Build:
{
"cmd": ["/usr/local/bin/node", "$file"],
"selector": "source.js"
}
Writing just 'node' returns an error, that node isn't found. I quickly checked in terminal "Which node" and it returned /usr/local/bin. I switched to the above code and now the build just returns "finished in x.0s".
Even if I simply console.log, it just returns "finished in x.0s".
Also, I checked that node is working on my computer (from console, and it is returning my console.log()s). What might I be missing?
Thanks all!

This is a bit...ridiculous on my part. It seems you must first save the file before you can build system. I just wanted to test the environment and thought setting the build system would be enough.
Saving the file and then building solved the problem
*facepalm

Related

VSCode integrated terminal failed to launch

VSCode integrated terminal failed to launch and the error showed up:
The terminal process failed to launch: Path to shell executable "bash" is not a file of a symlink.
Tried to look for solution in official troubleshoot page but can't really figured the cause of the problem.
Starting an external terminal (gnome-terminal) using CtrlAltT is fine.
Also tried to re-install VSCode, removing cache etc. still the same issues. Happens to almost all my Ubuntu computer.
There is a similar fix in Windows https://stackoverflow.com/a/64020049/16346600, but how to do it in Linux? More particularly I can't find this terminal.integrated.shell.linux.
OS: Ubuntu18.04 LTS
VSCode: Version 1.57.1
It seems like VSCode somehow cannot find the path to executable for default profile "bash".
I fix by providing the exact binary path to bash.
Inside settings.json:
"terminal.integrated.profiles.linux": {
"bash": {
"path": "/bin/bash"
},
...
}

electron-updater auto update on linux

i am desperately in need for help. I have been trying this for so long and i got no results at all.
So, my problem is. I am using the electron-updater package to auto update my electron app. It's working on windows but on linux is another story. I have been looking everywhere and i can't find anything about it.
I am using electron-builder integrated with quasar to package my application, and, i did read about it in the documentations, it's only supported by AppImage formats. Okay that's fair, but what should i even do with that? I am using a custom url-schema and it just doesnt work, it doesn't install it anywhere. It just opens my electron app and that's not the behavior i am expecting.
I have tried using AppImage Launcher but i am getting this silly error (which i dont know why it happens), doesn't provide any description about it and i think i will just give up the project for linux (already did for MacOS) too. I have setup the desktop file, set the executable name, indeed it compiles and it installs perfectly on a .deb package, but i just don't know what to do with this .appimage extension.
My linux configuration on electron-builder looks like this (it will be interpreted by quasar)
linux: {
target: "AppImage",
executableName: "portscanner",
desktop: {
Name: "Port Scanner",
"Generic Name": "Port Scanner",
StartupWMClass: "portscanner",
Terminal: false,
Type: "Application",
MimeType: "application/portscanner;x-scheme-handler/portscanner;",
Categories: "Networking"
},
category: "Networking"
}
I will gladly take any help on this. Thank you guys in advance.
Edit:
I took note of the error i got on AppImageLauncher and it's the following:
Error registering AppImage in the system via libappimage
And in the terminal i have this error:
ERROR: appimage_register_in_system : Malformed desktop entry: Unexpected token ENTRY_KEY at line 8
But i have no ENTRY_KEY in my desktop config :/
Edit2:
I fixed it by removing most of the things of the linux desktop file (except for mimetype) but now i am facing this issue in electron-builder which is the following: "APPIMAGE env is not defined, current application is not an AppImage"
I know i have to put the path to the appimage application but which path? The one generated in the dist folder? A path pointing to $HOME? (tried that and didn't work). None of them work btw. I dont know what to do anymore.

Getting SublimeText2 to compile Typescript

Really excited about using Typescript on the Mac however, even after a full day of troubleshooting, unable to get it to compile in SublimeText. Followed these directions (the first at the top) to install nodes and npm>
https://gist.github.com/isaacs/579814
Installed Typescript
sudo npm install -g typescript
Installed the syntax highlighting package for sublime
http://msopentech.com/blog/2012/10/01/sublime-text-vi-emacs-typescript-enabled/
Created a build file 'typescript.sublime-build as follows
{
"selector": "source.ts",
"cmd": ["tsc", "$file"],
"path": "/usr/local/bin",
"file_regex": "^(.+?) \\((\\d+),(\\d+)\\): (.+)$"
}
When I type $which node I get
/usr/local/bin/node
When I type $which tsc I get
/Users/<username>/local/bin/tsc
BUT, whenever I try to compile even the simplest .ts file in SublimeText the first effort message I get is
[Errno 2] No such file or directory
Can anyone suggest further troubleshooting steps?
I struggled with a little too. It seems the PATH is quite different when trying to run commands directly from the build system than the terminal, and this is a cause of problems.
What I did as a simple workaround was just set my command to run a Bash script, i.e. in the sublime.project file have the command as..
"cmd": ["./build.sh"]
.. and then in the build.sh script in my project folder simply run the compiler, i.e..
#! /bin/bash
tsc --target ES5 foo.ts
Obviously this assumes foo.ts pulls in all the other project files so they get compiled (or you could glob for the files on the command-line seeing as you're running a Bash command).
This might be a quick and simple solution for you.
You could do what my team mates do. Use Sublime Text for text editing with a grunt watch in the background compiling any files that change : https://github.com/basarat/grunt-ts

Command "docpad run" is getting error: "module" is undefined

I've migrated my configurations from docpad.coffee to docpad.js (personal preference on using plain Javascript)
Since then, I'm not being able to execute the command
docpad run
And I'm keep getting this error:
I've validated my configurations against JSLint and made sure there's no syntax error.
I'm good to go with docpad.coffee, but it'd be great if someone could help me on fixing this
You can use docpad.cmd run instead of docpad run to distinguish between the local docpad.js and the global npm-installed docpad.cmd.
This is because windows recognises the ".js" extension as a javascript file and tries to run your docpad.js file when you issue the "docpad run" command. Windows script host is what is used by windows to run js files natively (so actually nothing to do with node or docpad itself). The reference to "module" in the error message is because that is the first line of the docpad.js file and the windows script host doesn't know what "module" is. You can just rename your docpad.js file to .coffee (I believe all javascript is valid coffee script) and then the windows message will disappear.
Edit: I've just went and tested this on the docpad skeleton which has a docpad.js file instead of docpad.coffee. Simply renaming it to docpad.coffee does indeed solve the problem. Renaming it back to .js then causes the 'Windows Script Host' error message to appear when the "docpad run" command is issued.

Problems with LESS Sublime Text Build System

On OS X 10.7.2, I created a small build system in Sublime Text 2 that will compile my LESS files into CSS for me, but it seems to be having a problem.
{
"cmd": ["/usr/local/lib/node_modules/less/bin/lessc", "-x", "$file", "$file_path/$file_base_name.css"],
"selector": ["source.less"]
}
I've installed Node.js v0.6.6 using the standard OS X installer package, and installed less v1.1.6 using npm into the /usr/local/lib/node_modules folder. Switching to my build system works fine, but when I attempt to run the build I get the following error message:
[Finished]env: node: No such file or directory
Running the command from the terminal works perfectly fine, it's just Sublime that is taking issue.
Another way to solve this is to install LESS globally, as it looks like you've already done:
npm install -g less
Then pass shell=true as a variable in the build script:
{
"shell" : true,
"cmd": ["lessc", "-x", "$file", "$file_path/$file_base_name.css"],
"selector": "source.css.less"
}
That runs the lessc command in the terminal in a way you'd expect.
While I am still unsure as to why there is a difference between Sublime Text 2 and running the build system in the terminal, I fixed the issue I was encountering by explicitly adding the value of $PATH to my build system.
Acting on the documentation provided on the Sublime Text Help page, I set up my build system to be the following:
{
"cmd": ["/usr/local/lib/node_modules/less/bin/lessc", "-x", "$file", "$file_path/$file_base_name.css"],
"selector": "source.css.less",
"path": "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin: No such file or directory"
}

Resources