npm not work in windows 7 - node.js

I install the nodejs its work wihtout any problem but when I try to install some packge with the npm.
The npm not work and give me this problem:
error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js'
This the varaible system path:
The floder C:\Users\xxxxx\AppData\Roaming\npm is empty.
I dont now what is the problem why not work?

npm usually comes shipped with Node. Setup issues are very common while working with Node. I think it will be faster for You to do a clean reinstall than try to fix Your issue.
What I found working the best for me is using nvm. It's a command line tool which lets You install any version of Node and switch to any other version at any time.
You are on Windows 7, so what You are interested in is nvm-setup.zip from this source:
https://github.com/coreybutler/nvm-windows/releases
Run the setup and if it asks You about controlling versions press yes.
Now, run Your cmd.
Administrator#MECH-PC D:\a
$ nvm list
* 6.8.1 (Currently using 64-bit executable)
5.0.0
4.0.0
0.10.38
Administrator#MECH-PC D:\a
$ node -v
v6.8.1
Administrator#MECH-PC D:\a
$ npm -v
3.10.8
Administrator#MECH-PC D:\a
$ nvm install 5
5.0.0
Downloading node.js version 5.0.0 (64-bit)... Complete
Creating C:\Users\Administrator\AppData\Roaming\nvm\temp
Downloading npm version 3.3.6... Complete
Installing npm v3.3.6...
Installation complete. If you want to use this version, type
nvm use 5.0.0
Administrator#MECH-PC D:\a
$ nvm use 5
5.0.0
Now using node v5.0.0 (64-bit)
Administrator#MECH-PC D:\a
$ nvm list
6.8.1
* 5.0.0 (Currently using 64-bit executable)
4.0.0
0.10.38
Administrator#MECH-PC D:\a
$ node -v
v5.0.0
Administrator#MECH-PC D:\a
$ npm -v
3.3.6
Note
On Windows nvm use will persist selected version. In unix You need nvm alias default [VERSION] e.g. nvm alias default 6.8.1
Additional reading for unix guys:
http://www.nearform.com/nodecrunch/nodejs-sudo-free/

#Kamil Mech
I install tje nvm dna work but howa can I in integrate with nodejs ???
oooh I dont now where is the porblem but the npm now work

Related

Rollback to previous version of NPM

I want to use an earlier version of node v14.7.0 and its respective npm. When I do that I still get the latest version of npm and not the earlier version.
How to get the earlier version?
You can rollback to the old version of npm using the following command
npm install -g npm#<version number>
for example:
npm install -g npm#3.1.1
if you want the latest version you can use:
#latest
instead of version number.
When I do that I still get the latest version of npm and not the
earlier version.
It could be due to not deleting it properly or you might be installing the latest version again.
I recommend you to use nvm if you are using a linux-based OS and nvm-windows for windows based systems. It will help you to keep different versions of node and npm and you can switch later based on the project requirements.
It is easy to install and use. Linux command:
nvm install node
For windows, you can install nvm-windows here.
nvm list
Once you do it, you can install different version of node and it will automatically give its associated npm version:
nvm install `versionnumber`
It is recommended to use Node Version Manager(NVM) to simplify changing versions. Then you can use like below from terminal or command line:
// Check installed versions:
nvm list
// Change version to 15:
nvm use 15
// Check node version:
node -v
// Switch version:
nvm use 16
// Install different version:
nvm install 11

not able to change node version after doing npm install in mac

I was using node versions 10.x.x and 12.x.x using nvm before.
Then i installed new node version using the command
npm install -g node#14.
and also installed new npm version using the command
npm install npm#6
after doing these if i do nvm use v10
its still not switching to node version 10
nvm list // apply this first
you will see differents options
v10.24.1
v12.13.0
v12.22.6
-> v14.13.1
...
then apply the command to use
nvm use v10.24.1
in your case:
nvm use v10.22.0
you need to copy paste completly like, not just v10

npm is not compatible with Node.js

I had node installed in my machine and everything was working fine. During an online course made in 2019, the instructor was using an earlier version of npm (v5.5.1) and advised everyone to use the same version with him for follow up reasons. So I downgraded to v5.5.1 but now I keep getting one same error (incompatibility) for almost all commands. I read some solutions to similar problems here and even tried extra steps but the problem still persists.
I uninstalled node from my system, restarted the system and reinstalled node but the version of npm still remained v5.5.1.
I tried to uninstall npm from the command line npm uninstall -g npm but it threw incompatibility error.
I searched the web for compatible version of node.js for npm v5.5.1 and got node v10.15.1 which I downloaded installed with several system restarts but my node and npm still remain incompatible. Please what can I do?
You should use nvm which is the Node Version Manager, cURL:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
commands:
nvm install <version> Download and install a <version>
nvm use <version> Modify PATH to use <version>
nvm ls List versions (installed versions are blue)
Helpful reads:
How can the default node version be set using NVM?
How to change node version with nvm

Install nodejs 4.2.0 or above version

I have installed node and npm using following command in my Ubuntu machine:
sudo apt-get install nodejs npm
On checking version of installed, I could see following:
$ node -v && npm -v
v0.10.25
1.3.10
But I want nodejs version to be 4.2.0 or above. I am trying to install VSO Linux agent for a project. On executing node agent/vsoagent, I get error that node version should be 4.2.0 or above.
How do I install it and also make sure that the already installed ones are removed with node -v && npm -v gives me new version number?
Thanks
You already have npm, so you can use n manager to install any version you want (4.4.4 for ex): maybe you should use sudo for global install:
npm install -g n
n 4.4.4
Or
n latest
After that you can just run n to select version that you prefer. I use latest LTS and latest 6.x side-by-side and switching them anytime i want.

Why nodejs command line always install an old version?

My questions are
Whenever i tried to install nodejs using command line
# apt-get install nodejs
it installs the older version (in my case it installed 0.10.x),where as the current version till date is 4.1.2 .Why this command do not gives me a latest version.Is there any other way to install the latest version though i tried using nvm.
I checked the installed versions
node -v && npm -v && cordova -v
v0.12.7
3.3.5
5.3.3
It seems node v0.12.7 is installed in my system but when i am trying to install ionic
npm install -g cordova ionic
i am finding the error
npm WARN engine xmlbuilder#2.2.1: wanted: {"node":"0.8.x || 0.10.x"}
(current: {"node":"0.12.7","npm":"3.3.5"})
even my current version is greater then the required version why its throwing me an error,do it strict with the specific version.
Do not make use of apt get, there is no harm in installing node using platform specific tools but it is better to make use of nvm which is consistent among all platforms.
Make sure to uninstall the current version of node this post can help.
Next follow these steps.
Go to https://github.com/creationix/nvm
Use curl to install nvm curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.28.0/install.sh | bash
Source your profile source ~/.profile
Install NodeJs nvm install v4.1.0
Alias installed version to default nvm alias default v4.1.0
Set aliased version as the final node version nvm use default
node -v will result in v4.1.0
In your case you may have to install version 0.10.x, you can also do nvm ls-remote to list available versions for download.
it's warning not an error so don't worry and if you want to install ionic platform then use bellow commands and still you face any problem then message me.
npm install -g ionic

Resources