Why I am not able to install some packages in npm? - node.js

I'm using npm andI noticed that it's not always possible to install packages. For ex I'm able to instal jquery using regular npm command npm install jquery but I'm not able to install webpack-watch-server using command npm i webpack-watch-server besause of an error
npm ERR! network request to http://registry.npmjs.org/homedir-polyfill failed, reason: read ECONNRESET
What does it mean? Does some dependencies of the package which I want to install are not available anymore or should I reconfigure npm?

I solved my problem by installing dependencies with npm ERR! status manually:
first I install homedir-polyfill separately and then again webpack-watch-server

Related

Cannot install npm Fluid Player

I am trying to install Fluid Player in my angular project
By - npm i fluid-player
But Getting this error
Like the error message says you should try installing npm i fluid-player --legacy-peer-deps or npm i fluid-player --force
--legacy-peer-deps: ignore all peerDependencies when installing, in the
style of npm version 4 through version 6.
--force: will force npm to fetch remote resources even if a local copy exists on disk.

NPM install not working - one of the dependencies is missing

Whenever I try to execute npm install or npm i, I get this error:
npm ERR! code MODULE_NOT_FOUND
npm ERR! Cannot find module 'json-parse-helpfulerror'
I cannot update NPM through npm install npm -g or npm i npm -g, becuase it produces the same error. My computer was very low on space, and I have a feeling it might have deleted one of NPM's dependenices. The actual npm command works though.
Is there any way to fix this?
Reinstalling npm will fix the issue.
curl -L https://www.npmjs.org/install.sh | sh
If you're on Windows and you have a broken installation, the easiest thing to do is to reinstall node from the official installer.
You can also try clearing the cache
npm cache clean

Local grunt installation gives error

npm install -g grunt-cli //done successfully
npm install grunt --save --only=dev
gives following error
(node:11000) fs: re-evaluating native module sources is not supported. If
you are using the graceful
-fs module, please update it to a more recent version.
npm WARN prefer global coffee-script#1.10.0 should be installed with -g
project#1.0.0 C:\Users\Live\Desktop\node grunt\final
`-- (empty)
npm WARN project#1.0.0 No repository field.
npm ERR! code 1
Tried uninstalling grunt-cli, cleaning npm cache, then re-installing, but still the problem persists.
Ok short recap:
When in doubt remove your node_modules and install all packages again using npm install
If that didn't work, try updating your npm by executing npm update -g npm and redo step 1.
If that didn't solve your problem, try upgrading to another NodeJS version using nvm or n.

How to install certain node version from command line

I want to install node 6.9.4.
In windows console I try with this:
npm install node#v6.9.4
And it throws this error:
npm ERR! No compatible version found: node#v6.9.4
npm ERR! Valid install targets:
npm ERR! 0.0.0
In linux the result is similar. I try with
sudo npm install node#v6.9.4
and the output is:
npm ERR! version not found: node#6.9.4-cls
Is there a way to install certain node version with npm?
You should use nvm to install and manage node versions and not npm
NPM is the package manager for node and not a version manager.
To install a particular version of node using nvm, just do
nvm install v0.10.32
NPM should be used to install packages/modules.
So say you need to use request module for a particular project
You can do
npm install request
Both these support tons of options which could be found over the documentations
I recommend you use nvm: Nodev Version Manager
It would be as easy as
nvm install 6.9.4
It's a really good tool to manager all of your node versions.

Node.js package installation error

I had install Node.js 4.2.2
i am trying to install socket.io package using npm install socket.io
but the npm installer just keep running with no error output in console after 30min..
Try to install some another package, mongoose for example. If it also fails try to reinstall npm by
npm install -g npm
Try the following:
npm install -g npm
npm cache clean
npm install socket.io
Also check if you permission to create node_modules folder in the directory you run npm.
You can downgrade your nodejs to v.4.2.1 for example, don't forget to clean npm cache after that, and then run npm install command.
First try to remove these packages and then install. Like
npm remove socket.io
Then
npm install socket.io
may be the incomplete installed files are blocking it to install properly
You need to update your npm anyway.
Try from link install:
curl -L https://www.npmjs.com/install.sh | sh
Or you can compile it with make if you clone sources from github

Resources