So I'm having a lot of trouble getting my node module command line commands to run correctly.
For example if I try and run gulp I get a
>gulp
'gulp' is not recognized as an internal or external command,
operable program or batch file.
So I have tried making my environment variable NODE_PATH
%APPDATA%\npm\node_modules\
%APPDATA%\npm\node_modules
%APPDATA%\npm
but none of these seem to work. The only command I can use to get my gulp to run with is
C:\Users\Aaron\Documents\GitHub\2015fallTeam14>node %NODE_PATH%gulp\bin\gulp
[12:10:32] Using gulpfile ~\Documents\GitHub\2015fallTeam14\gulpfile.js
It would appear that cmd is not running my node with my NODE_PATH variable along with my command, but I do not know how to to fix this
You need to set the system PATH variable to tell the command prompt where to find gulp.bat (which npm creates).
This has nothing to do with Node itself.
I had add the following
Edit "PATH" environment variable and add %APPDATA%\npm
from
https://stackoverflow.com/a/27295145/4249440
Im not sure why this works though. I would like to know how the cmd knows to run node on this file path.
Related
If I type any Nodejs command in Vscode Terminal there comes the error
The term "nodemon" was not recognized as the name of a cmdlet, function, script file, or executable program. Check the spelling of the name, or if the path is correct (if included),
and repeat the process.
It also doesn't works in external Terminal but it works in Terminal which isn't opened by VSCode.
Thanks for your help!
If you're using windows, you should use the npx command to run modules.
It should come preinstalled alongside npm
npx nodemon
You have to make sure that the variables:
C:\Program Files\nodejs\
C:\Users\(your Username)\AppData\Roaming\npm\node_modules
are present in your system environment variables under the path tab.
TL;DR
I cannot execute commands such as tsc unless I include npx before it (e.g npx tsc). How can I fix this?
The title is a bad explanation of the problem I have.
Say I have installed an npm package with a CLI with it (typescript in this example). And the CLI is used like
tsc <filename> or just tsc. But whenever I try to do it like that, I get an error like
'tsc' is not recognized as an internal or external command,
operable program or batch file.
But... when I do
npx tsc
then it works!
So whats the problem?
The problem with doing npx tsc is because
npx is slow at executing commands
its annoying having to type npx and the front of every command.
And the thing is, this was originally not a problem with WSL.
Why dont you just use WSL?
I have always had problems with WSL (primarily permission issues due to security reasons) and so I uninstalled WSL and just used command prompt. I would have perferred using WSL but it was simply not an option.
Other Info:
I am using Windows command prompt.
I have installed the packages globally
So is there a way to just execute commands that way or is it Command prompts fault?
! this only works for Windows !
Ok, so I came across this post and thankfully, the first answer there was the solution!
Just add %USERPROFILE%\AppData\Roaming\npm to the path variable in system variables!
To access the system variables, press the Windows key, type Environment variables and click on Environment variables at the bottom of the window. The path variable can be found under User variables for (profile name).
When installing node.js for the first time and using the YEOMAN library, I found that it did not recognize the library despite installing it correctly.
When executing in console
yo swaggerize
Returns the error "yo it is not recognized as an internal or external command, program or batch file executable"
After several laps the problem is in node.js and in the PATH.
I post the solution in the next post.
The solutiĆ³n for me, it's simple.
In windows-> go to pc properties->advanced configuration-> environment variables
Show Path variable and edit.
C:\Users\youruser\AppData\Roaming\npm;
C:\Program Files\nodejs;
Save restart your console and run the command again
Each and every thing was fine
only problem was path
so I set path in environment variable.
This path I set in environment variabel
C:\Users\user\.npm-packages
where 'user' is my user name, please use your user name.
Then my 'yo', 'bower' command start to executed
Thanks
I'm working in a node application that can be started like this from a Mac machine:
DEBUG=app.* ENVIRONMENT=local node server/index.js
However, when trying to run that script in a Windows command line, I get the following message:
" 'DEBUG' is not recognized as an internal or external command, operable program or batch file."
When running the script without the parameters, I don't get any error.
How can I pass said parameters to my index.js from Windows?
Run this in the CMD window where you'll run your node app.
SET DEBUG=app.*
SET ENVIRONMENT=local
node server/index.js
Or if you want it to be in a single line, type this.
SET DEBUG=app.*&&SET ENVIRONMENT=local&&node server/index.js
To make this variable changes persistent, you should edit your environment variables in control panel.
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