use vscode command in terminal No such file or directory - javascript

when I use code command, I get the error
$ code 2to3
/usr/local/bin/code: line 10: Loading sentinel dylib...
Successfuly loaded sentinel.dylib.
/Applications/Visual Studio Code.app/Contents/MacOS/Electron: No such file or directory

Just add the VSCode bin path to the path environment variable.
The path showing in my Windows system is C:\Users\sas\AppData\Local\Programs\Microsoft VS Code\bin
For Mac follow this Run / Open VSCode from Mac Terminal

Related

How to properly connect linter in Atom with jshint

I want to use the linter package in the Atom Editor. I have installed the packages "linter" and "linter-jshint". Additionally I installed jshint via npm (globally) and downloaded the jshint-repo from GitHub.
When I just try to run the linter on an open .js file in Atom, it fails with message "Error running JSHint". The same happens if I point the executablePath for linter-jshint in the Atom config to the downloaded repo folder.
When I set the executablePath to the node.js Module ("linter-jshint": executablePath: "C:/Users/Username/AppData/Roaming/npm/node_modules/jshint") it just shows a warning ("JSHint return an invalid response, check your console for more info"). Developer Tools console shows:
[Linter-JSHint] SyntaxError: Unexpected end of JSON input
at JSON.parse ()
at Object. (main.js:157)
at Generator.next ()
at step (C:\Users\Username.atom\packages\linter-jshint\lib\main.js:3)
at process._tickCallback (internal/process/next_tick.js:103)
What am I doing wrong? Do I have to point to another subdir or a specific file?
Username contains space and a german umlaut "รถ".
PS: I can execute jshint from command line and it works.
On Executable Path field, you should actually point to jshint executable file, like this:
H:\node_modules\jshint\bin\jshint

Building a JavaScript build system in Sublime Text

I'm trying to work on an application using node.js, and am trying to build a JavaScript build system in Sublime Text 3 on my Ubuntu OS. I created a new build system file in Sublime Text called nodey.sublime-build, the contents of which were:
{
"cmd": ["node","$file","$file_base_name"],
"working_dir": "${project_path:${folder}}",
"selector":"*.js"
}
Now, my node.js installation is stored in the following path: /tmp/node-v0.12.7-linux-x64.
However, when I try to run a JavaScript file called chat.js which is stored in the following location: /opt/lampp/htdocs/chat/chat.js, Sublime Text throws the following error:
[Errno 2] No such file or directory: 'node'
[cmd: ['node', '/opt/lampp/htdocs/chat/chat.js', 'chat']]
[dir: /opt/lampp/htdocs/chat]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games]
[Finished]
I'm not really sure if this is the right method for creating a new build system. After building the nodey build system, I went to Tools -> Build System and selected nodey.
What seems to be wrong with my settings?
EDIT:
I ran a sudo apt-get install node inside the same directory as chat.js , and now when I try to run the JavaScript file in Sublime Text, I get this:
[Finished in 0.0s with exit code 1]
[cmd: ['node', '/opt/lampp/htdocs/chat/chat.js', 'chat']]
[dir: /opt/lampp/htdocs/chat]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games]
However, even though there are no noticeable errors, the output of the file, which included a console.log("Hello World"), wasn't displayed.
For anyone else encountering the same error, try running the following in your terminal if you're a Linux user:
sudo apt-get install node
sudo apt-get install nodejs-legacy
This solved the problem in my case.

Node.js with Webstorm -

I've followed this example to try and add a record to MongoDB database.
When trying to run ./server/server.js I get the following message (at 2:22 in video):
"C:\Program Files (x86)\JetBrains\WebStorm 9.0.1\bin\runnerw.exe" "C:\Program Files\nodejs\npm" server.js
CreateProcess failed with error 193 (no message available)
Process finished with exit code 0
The node.exe path is right but don't know why I'm getting this error and can't find information on debugging it.
I got the same error while using WebStorm with Babel as the Node executable. After re-installing the dependencies, the correct path to the babel-node executable was node_modules\.bin\babel-node.cmd.

Karma "not found" in NetBeans after upgrading to Yosemite

I have a WAR project in NetBeans which uses Karma with Jasmine to unit-test the JavaScript files. The platform is Mac OS X. Things worked as they should under Mavericks, but after I upgraded to Yosemite, it no longer works, with the error message :
Failed to execute goal com.kelveden:maven-karma-plugin:1.8:start (default) on project Insight-war: There was an error executing Karma. Cannot run program "karma" (in directory "/Users/thja/Documents/Projects/kpi2010_core/WebGIS/Insight-war"): error=2, No such file or directory -> [Help 1]
It tries to execute the following command, as printed in the log:
karma start /Users/thja/Documents/Projects/kpi2010_core/WebGIS/Insight-war/src/main/webapp/config/karma.conf.js --browsers PhantomJS --reporters dots,junit --single-run --no-auto-watch --colors true
I can run the exact same command in the Terminal without a problem - it executes and give the test results. which karma gives the result /usr/local/bin/karma, and /usr/local/bin is part of the global PATH.
Is there any fix one can do for this, or do I just have to post an issue at the Maven Karma Plugin page?
Platform:
Mac OS X 10.10 Yosemite.
NetBeans 8.0.1
maven-karma-plugin 1.8
Java 1.7.0_45
It seems to be related to Yosemite turning off /etc/launchd.conf, so NetBeans doesn't get the correct PATH variable - so not directly related to Karma.
I fixed it by setting PATH=${PATH}:/usr/local/bin in netbeans.conf (within the NetBeans app package). Then the karma part of the build script runs successfully within NetBeans.

Bender.js: "bender server run" command opens the bender.js config file in directory instead of starting bender.js server

I am new to bender.js and I am trying to run the example project at:
https://github.com/benderjs/benderjs-example-project
After going through the installation steps,
I am unable to access bender.js server at:
http://localhost:1030
I have installed bender.js and all the dependencies stated in the example project.
This was due to executing the ".js" from the command prompt. As it turns out, Windows executes ".js" files with WSH or the default program(notepad in my case) associated with the file extension.
Executing the same script from a PowerShell or Git Shell or any other UNIX based shells should solve the issue.

Categories