yeoman is not working in windows - node.js

Node version 0.10.4 and npm 1.2.18 is installed in windows 64 bit.after that I use
'npm install -g yo' to install yeoman .But yo is not installed in my machine.After installation when I write 'yo --version',then error gives that yo is not recognized as an internal or external command.Please suggest how to install yeoman in windows.

Node seems to be installed in "c:\Program Files\nodejs\" however yo seems to get installed in "c:\Users\\AppData\Roaming\npm\"
If you check this folder there should be a yo.cmd file. If there isn't then you have another issue and this will not fix our problem.
You can use the %APPDATA% variable as well.
You'll have to add this new path to your %PATH% environment variable.
Fix:
Right click "My Computer"
Click on Properties
Click Advanced system settings
click on Advanced tab.
click the Environment Variables... button
find the PATH variable and add to its value %APPDATA%\npm\ (use semicolon ";" to separate what you add from what is already there)
make sure that there are no extra spaces around the semicolon

Related

npm -v. The system cannot find the path specified

I installed node js on windows 7 from https://nodejs.org/en/download/. When I run node -v out put is v8.9.4 But when I check npm -v out put is
The system cannot find the path specified.
5.6.0
In path variable entry is as
C:\Users\<username>\AppData\Roaming\npm
blank npm folder is present on above path
I added entry in path variable as it is recommended in some answer
C:\Program Files\nodejs
but still getting same error. I tried solutions I found online like above path entry, re installation, global installation of npm but still same error
I found a solution in this article: https://www.thetopsites.net/article/53531888.shtml
"I needed to move my node paths further up the list. Windows must have been looking for NPM in the wrong path variable. I moved my node path to the top of the system path variables and now NPM works."
It helped me after a day of struggle.
More details for the solution provided by #Thomas.K:
Open Windows Settings and search for 'environ' like here:
Make sure to choose the one for "system environment", and in the dialog which appears press this button:
You will get this dialog
There are two PATH declarations, at top and bottom. You will have to remove the npm entry off the upper list, and paste it into the top of the lower list. This should solve the problem of "The system cannot find the path specified".

node 6.11.3 NODE_EXE not found in IntelliJ

I've updated my project to use node 6.11.3. When I now try to start a npm-script by using the Run-configurations provided from IntelliJ, I always receive the following error:
Error: Failed to replace env in config: ${NODE_EXE}
Important: This error appears only if I start npm from within my project. If I use the windows cmd, the error doesn't appear.
What could possibly have changed between node 6.11.2 and 6.11.3? Because with the prior version, everything worked fine.
A workaround for me is to add the NODE_EXE variable to my run configuration, but In my opinion, that shouldn't be needed, because it worked in 6.11.2 too.
Looks as if you have ${NODE_EXE} variable set in one of your npmrc files (see https://docs.npmjs.com/files/npmrc#files), and it can't be properly expanded for some reason when you run your script in the IDE.
is the issue specific to certain project?
how many npm versions do you have installed? Please check that npm chosen in Node.js Interpreters dialog is the same as you use in cmd shell?
please create an env.js file with console.log(process.env) and try running it via npm ("env" : "node env.js") in both cmd console and WebStorm - what is the result?

(Visual Studio Code & NodeJS) - Could not install typings files for JavaScript language features?

I had installed latest NVM and used it to install NodeJS (macOS). Everything was okay, NodeJS ran normally. But when I started VS Code the following message appeared:
Could not install typings files for JavaScript language features. Please ensure that NPM is installed or configure 'typescript.npm' in your user settings
So I tried to find more official information from VS Code team. They said to insert the path to the npm executable file in the typescript.npm setting.
I used $ which npm to find the npm directory :
/Users/myusername/.nvm/versions/node/v8.3.0/bin/npm
but there is no executable file there. I also tried to insert this address into VSCode typescript.npm setting but it did not work.
My question is, where can I find the npm executable file address on macOS to insert into this typescript.npm setting so the error wouldn't pop up anymore ?
Thank you!
Releated VSCode issue: link Maybe it will help you.

I am unable to deploy my platypi demo app

I have been following the instructions on how to get started with platypi on https://platypi.io/docs/getting-started.
Everything was going well, until I tried to create the deployment package (https://platypi.io/docs/getting-started/1251/Deploy-to-a-Device).
When I run the node command "grunt build-cordova" I get the following error: "Error: Failed to run 'ant -version'...". So I tried installing ant first by entering the command "npm install node-ant".
However, when I do so, I get an error saying that I need to have Visual Studio 2010 build tools installed.
I do not want to install VS 2010 just to install ant, since I already have VS 2013 and 2015 installed.
My question is: How can I get the grunt command "grunt build-cordova" to work without installing VS 2010?
Thank you.
Did you try installing Ant directly from the site?
Download the binary and put it somewhere on your computer (I used C:\apache-ant-1.9.4), then add the path to the installed location to your PATH environment variable. You can find out how to do that here, the instructions are for java, but it works for other variables.
I added an ANT_HOME environment variable with a value of "C:\apache-ant-1.9.4". Then I edited my Path to include %ANT_HOME%; at the end.
Afterwards you will need to restart any open command prompts. You may also have to run npm uninstall node-ant to avoid conflicts.

Error code: 800A1391 Source: Microsoft JScript runtime error Running Grunt - Module is undefined

New Grunt user here who is using a lot of new tools (npm nodejs) today.
I've got Grunt "installed" and have been able to create a grunt.js file using the init task as described here: http://net.tutsplus.com/tutorials/javascript-ajax/meeting-grunt-the-build-tool-for-javascript/ and here: https://github.com/cowboy/grunt/blob/master/docs/getting_started.md. But whenever I run the "grunt" command I get an error:
Windows Script Host
Script: c:\users\[]\Documents\code\grunt\grunt.js
Line: 2
Char: 1
Error: 'module' is undefined
Code: 800A1391
Source: Microsoft JScript runtime error
As explained in the FAQ, you need to type grunt.cmd instead on Windows because the OS tries to launch grunt.js
Or you can install grunt-cli globally instead. This package will run any version of Grunt if it's been installed locally to your project.
SOLVED !!
So, this problem occur because windows by default associative < *.js > files
with >>
"Microsoft Windows Based Script Host".
grunt need to open by default with (grunt.cmd).
it easy to slove, by change default app (open with..)
Guide :
Go to any javascript file with "js" extension. (any file)
Right-Click(mouse) > Properties > "Opens with:" Change...(button)
Choose Notepad ( or any javascript IDE ).
PROBLEM SOLVED ! :)
good luck
If you're getting a "Microsoft JScript runtime error" that means that node.js isn't even getting invoked; instead Windows Script Host is trying to run your code. That's probably a problem with filetype associations; IIRC Windows defaults to trying to execute a ".js" file with WSH. You may wind up having to create a shortcut to your script, specifying a command line (probably something like "node %1") and a starting directory in order to make sure that it's executed properly.
It would help if you could tell us exactly how you're trying to invoke your code.
it seems that in the latest versions of the grunt modules, you would have to do the following to have it work under windows:
remove any globally installed grunt
npm uninstall -g grunt
install grunt-cli globally
npm install -g grunt-cli
install grunt locally into your project
npm install grunt
installing grunt (v0.4.x) globally does not seem to create the necessary grunt.cmd anymore. it seems that the recommendation is now to have grunt installed locally to be able to use version-specific Gruntfiles
As Florian F suggested, running grunt.cmd works. This is because of the process Windows is looking for your grunt command.
When typing grunt -h Windows will proceed to look for the following files:
./grunt.cmd
./grunt.* (grunt.js is found in this case which is why you see "module is undefined")
%APPDATA%/npm/grunt.cmd
An alternative to using "grunt.cmd" is to use grunter which simply renames the command to grunter... then you no longer have this problem.
To answer this, first we need to understand that the error is caused because it is being executed by Windows Script Host.
Now, run the code from your cmd promt with the following syntax:
>node <application_name>.js
this will allow the Node.js application to open through V8 JavaScript engine(Google's).
P.S: Please reply back if this has helped in resolving your issue else post the problem you are facing after trying this.
I had a similar issue, the problem is file association, I would recommend:
right click on a .js file and choose open with.
then you choose nodejs/node.exe (somewhere in "program files" folder
then make tick box where it says "always open .js files " (paraphrasing)
That should do the trick.
I went through the same issue when running an old Node project.
The issue was with the name of the js file, it was node.js. So the while running the command node node.js, it was opening up a windows dialogue box.
I just changed the name of the file to app.js and the error flew away.
So, in my case i had tryed all the mentioned above with no result.
But i have fund that im dont type: node in the full sentence as the following snipet
node script.js.And remember never understimate your own miscoding.
Solution:
Go to any javascript file with "js" extension. (any file)
Right-Click(mouse) > Properties > "Opens with:" Change...(button)
Choose Notepad ( or any Javascript IDE like VS Code ).

Resources