node.js executables not working on windows - node.js

I'm attempting to make package run via executable, but it's not executing on windows. Not sure what's wrong, and helpdocs haven't supplied much help.
Whenever I try to run it with the below snippet, I get a "Windows Script Host" error GUI.
"bin": {
"kaga": "bin/index.js"
}
Whenever I use this, I get a terminal error (included below)
"bin": {
"kaga": "./bin/"
}
"C:\Users\Kagetane\AppData\Roaming\npm\\node_modules\kaga\bin"
'"C:\Users\Kagetane\AppData\Roaming\npm\\node_modules\kaga\bin"' is not recognized as an internal or external command, operable program or batch file.

Wait, never mind, I got it. All I needed was a shebang line in bin/index.js
#!/usr/bin/env node

Related

'tsc' is not recognized as an internal or external command on Windows when installed globally

I've seen bunch of 'tsc' is not recognized as an internal or external command issues here on StackOverflow but none of them could help me solve my problem.
I've installed typescript globally with:
npm install -g typescript
There are tsc and tsc.cmd files in C:\Users\<user_name>\AppData\Roaming\npm directory. So %AppData%\npm\tsc --version command works.
I've got C:\Users\<user_name>\AppData\Roaming\npm directory in my user's PATH.
More, when I run where tsc command in arbitrary directory, I get:
C:\Users\<user_name>\Desktop>where tsc
C:\Users\<user_name>\AppData\Roaming\npm\tsc
C:\Users\<user_name>\AppData\Roaming\npm\tsc.cmd
However, when I simply try to run tsc, I got:
C:\Users\<user_name>\Desktop>tsc
'tsc' is not recognized as an internal or external command,
operable program or batch file.
Exactly the same problem occurs with grunt and uglifyjs.
I managed to solve this problem.
C:\Users\<user_name>\AppData\Roaming\npm indeed was in user's PATH variable. I also have system variable called Path (yes, just first letter is uppercased) and there was no C:\Users\<user_name>\AppData\Roaming\npm in there.
When I added it to system's Path, it finally started to work.
Not sure that this is ok that two of my path variables have different names (in terms of cases). Also not sure that this situation led to problems.
Would be glad if someone could clarify this.
Try installing the linux console for windows the cygwin console., And run the command tsc from that console, I know it does not change much but sometimes I have solved many problems with that console.
https://www.cygwin.com/

Cannot run node.js program in command prompt

Arch-noobie here. When I try to run a node.js program in windows command prompt by stating its location, it will invariably say "[stated location] is not recognized as an internal or external command, operable program or batch file."
In all answers to similar questions, in all node.js manuals, it is assumed you can just run a node.js file by calling it from its location. There will always be the suggestion of trying some "hello world" example BEFORE establishing a server and so on.
Even if I clean the command prompt with "prompt $ cmd", and then write the whole location manually, I get the same message.
Can anybody help me with this? Thanks in advance.
By default, your node.js should be installed in C:\Program Files\nodejs location. Check for it.
Next, look for environment variables to be set at C:\Program Files\nodejs\bin
You can follow this link to check for the PATH and environment variables.
Then, restart your system. It should start working.
make sure you are typing node NOT npm

gulp-shell 'karma is not recognized an an internal or external command...'

I'm using gulp to concat, minify, and then test all of my JS. I want to include karma in there as well, but I can't seem to get gulp-shell 'karma start karma.conf.js' to work properly. Karma is added to PATH, as I'm able to run that command from the same working directory as the gulpfile in Windows Shell without any problems. I can also run other commands correctly, like 'ls', 'pwd', 'npm --version', etc but for some reason it doesn't recognize 'karma'.
I have also gotten this running on OSX properly, so it's an issue local to my machine. Any help would be appreciated.
gulp.task('run-karma', shell.task(['karma start karma.conf.js']));
error is
'karma' is not recognized as an internal or external command,
operable program or batch file.
Error in plugin 'gulp-shell' Message:
Command 'karma start karma.conf.js' failed with exit code 1

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.

I can't run test with "vows test/*" command on windows. How to use it? node.js

I've installed vows as module of my project and I've added the path "node_modules\vows\bin" to my environment path variable of windows vista.
note: I've also renamed "node_modules\vows\bin\vows" to vows.exe, because without the extension I get this error: 'vows' is not recognized as an internal or external command,
operable program or batch file.
Now wherever I put "vows" in my cmd in windows nothing happens, I cd into my test folder and I run "vows myFirstTest.js" and nothing happens. (when I say nothing happens my cursor in cmd is going to the top and then return to it's original position and it's doing this forever, therefore each time I try a vows command in cmd I have to close the cmd to run another command).
What I'm doing bad?
thanks
NPM is great at globally installing packages and making the executable for each operating system (UNIX-ish + Windows), so proceed with the following:
npm install -g vows

Resources