I can't successfully install anything with npm now it seems on my Ubuntu 15.04.
npm install -g gulp
/
Just spinns for ever and nothing happens, tried with sudo and without..
nodejs -v
v0.12.4
and
npm -v
2.10.1
I have tried
*Reinstall nodejs
*Clearing the cahce globally and locally.
*Removing nodejs manually
*Tried installing different npm packages (Gulp, browserfiy ..etc)
*Chainging the ownership of ~/.npm recursivly to me instead of root
But nothing gives, I feel the only thing left for me to do is reinstall ubuntu..
Do you have any suggestions? All help is appreciated!
This seems like a problem with your internet connection. Two possible reasons that I can think of are,
1) Connecting to the internet through a proxy server.
Then you will have to configure proxy for the npm. You can do this by adding HTTP_PROXY, HTTPS_PROXY environment variables to a value like http://proxy.company.com:8080 or when you are installing modules using this command.
npm --https-proxy=http://proxy.company.com:8080 -g install gulp
2) You don't use a proxy, but proxy setting are enabled in your computer.
If you don't use a proxy but if you have set up HTTP_PROXY, HTTPS_PROXY environment variables, npm will not be able to download the module because it automatically uses these settings. So remove those environment variables and try again.
If you use -d flag, you can see the details of the download.
npm install -g -d gulp
Hope this is helpful.
References: Using Npm Behind a Corporate Proxy
My suggestion is to develop everything using ubuntu 14.04. A lot of virtual server providers only let you use 14.04 if you choose ubuntu (such as Digitalocean). Also a lot of service providers (such as Docker and many others) use ubuntu 14.04 as their standard base ubuntu image for you to develop your services. And it will be much easier for you to code, test, ship in the same environment just like others do.
Related
I have spent my whole day on fixing this problem but can't see any light.
My node and npm version is below
And no matter what package I wanna install, it always show
I am sure that I am not in any proxy and I have already lower my node version from 18 to 14,
but the problem still exist!!!!
Could anyone know how to fix this problem help me?
I already tried every way to fix this but can't work.
Since when did the issue start? Did it occur after you installed any dependency or made any proxy / firewall related configurations?
However you can try one of the following ways to fix this issue
Delete node_modules folder and in terminal, write
npm install
Change your nodejs version, either upgrade it or downgrade it
Reinstall nodejs
Try some other package manager like yarn
Note: When changing your nodejs version, please ensure that your node version is compitable with the npm version
Edit:
If these solutions don't work, the error is most probably caused by network related issues, you can try the following fixes
In terminal, reset the registry path of your node package manager
npm config set registry http://registry.npmjs.org/
If you are using your organization's computer, you need to use a proxy, remember to change the proxy url and port as per your organization
npm config set proxy http://proxyurl.com:8080
npm config set https-proxy http://proxyurl.com:8080
Instead of local installation, try installing packages globally i.e
npm install -g mongoose
Clear the cache
npm cache verify
Switch your device to some other wifi network and then try installing some npm packages
I'm always struggling with updating node / npm packages or npm itself.
I have an Ubuntu machine where I have a global npm install, which I want to update.
npm install -g npm results in all sorts of '/usr/local/lib' access permission denied errors.
I can use sudo but then the ~/.npm dir in my default user account's home dir is owned by root, not by me. Which I assume will give trouble when installing or updating packages, and seems overall a bad idea anyway. I am using and running npm as me, not as root.
Upon searching I find several half-baked workarounds for this but I have a strong impression I'm doing something wrong. Or maybe I just misunderstand the issue at hand. I have trouble believing that a long term and widely used project like npm would suffer from such basic shortcomings?
What is the most correct, simple way to install npm globally on a regular linux environment?
Do not use the Ubuntu's node and npm version.
Ubuntu's repository locks you in one verson of node, which then also limits your available version of npm.
Either use node managers like nvm or n. They allow changing your node version with one command.
Or even docker containers. With Dockerfile you can create environments that mimick your production environment (or which basically is the same as production if you deploy your apps as docker containers).
I am completely new to topic of Node to be honest, but I can't find the answer for my question. I have Ubuntu 18.04 on my WSL, and want to install some tool called jscpd on my WSL. I have already done apt-get update and installed npm packages etc. To install jscpd, I use npm install -g jscpd and this causes showing some loading bar which never ends. Installing another things also does not work. Can you tell me whan can be a problem in it?
Okay, after some time I found the answer - essential was that I am behind company's proxy, and npm does not take info from .bashrc about proxy settings, so you have to set them independently by
npm config set http-proxy http://proxy_host:port
npm config set https-proxy http://proxy_host:port -> yes, as a https you should write http, not https, this is not figured out why.
I need some help and clarification regarding Yarn installation process.
MacOS ver. 10.14.2
I've installed Homebrew via official site (ver. 2.0.1).
I've installed NPM by downloading package from official site (ver. 10.15.1 LTS).
Now when I tried to install yarn via brew install yarn
I have the following error:
The post-install step did not complete successfully
You can try again using `brew postinstall node`
As I undertand, NPM installs node locally, when, for instance, I try to use create-react-app. When I use Homebrew to install yarn, it tries to install node globally. And we have conflict here.
I've found suggestion to use:
sudo chown -R `whoami`:admin /usr/local/
I am not entirely sure what this command does.
So, the questions are:
Why changing the owner of the folder should be a solution? How will it affect multi user system?
What is the correct way to install yarn?
Can be there any conflicts if node is installed globally and locally (app folder.)
P.S. Please correct me, if I have wrong understanding here.
As Trott points out, npm does not install Node. npm is a package manager that comes bundled with Node. If you install Node, you automatically install npm.
Why changing the owner of the folder should be a solution? How will it affect multi user system?
It's not. Changing the permissions of this folder is sometimes suggested as a workaround for when you have npm installed in a location owned by root. This can cause EACCES errors when you try to install packages globally.
What is the correct way to install yarn?
While you can install Yarn through the Homebrew package manager, I would recommend doing: npm install -g yarn.
Can be there any conflicts if node is installed globally and locally (app folder).
You can't install Node globally and locally. You can install multiple versions of Node on the same machine, however.
I'm not a big fan of having one global Node installation, as it makes it a pain to update (esp. if one application relies on an older version of Node) and, depending on how you install Node, it can lead to permissions errors.
The better way is to use a version manager. This will allow you to install multiple Node versions on your machine, avoid permissions errors and swap between these Node versions at will.
I would recommend using nvm. It works nicely on MacOS. The TL;DR for installing nvm is:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
But I would encourage you to look at the project on GitHub and read its README. There is also a good tutorial on how to use it here.
Once you have Node installed using nvm, run npm install -g yarn to install Yarn globally and you should be off to the races.
Finally, you might want to read this tutorial on using npm, as it could help to clear up some of the concepts.
HTH
I have faced a problem after install yarn by running npm install -g yarn command in my OS Windows 10 Pro. That was showing yarn' is not recognized as an internal or external command operable program or batch file.
Whatever, I have found the solution:
After npm,
go to CMD from your windows PC,
write : *npm install -g yarn*
then,
Go to Environmental Variables set up.
Edit Path and add new and paste:
C:\Users\User\AppData\Roaming\npm\node_modules\yarn\bin\
Restart your terminal. And then check again in your cmd by running :
*yarn* or *yarn --version*
I am having so much problems with the proxy system of my entertprise
I was changing parameter using npm config set changing the variable proxy and http-proxy.
I installed in my .npmrc next lines
npm config set proxy http://my_user:my_password#10.3.12.130:8080 -g
npm config set https-proxy http://my_user:my_password#10.3.12.130:8080 -g
What I have in my mind it is try to install grunt in VS2012 without using npm, maybe like nuget.
Is it possible?
I am getting this error page when I am using npm install -g grunt-cli:
Yes it is possible, you can download grunt and run it in your node.js environment, if your only problem is proxy or firewall but you have working node.js environment then just download it from the github.
You can download any npm package which is published also on the github and then copy it manually to you node_modules folder. Just beware that those packages may have dependencies on their own. SO that means you should run npm install in those downloaded folders and if it doesn't work do it manually for every dependency recursively until you are finished.
No, it is not possible.
This is from the Grunt getting started guide:
Grunt and Grunt plugins are installed and managed via npm, the Node.js
package manager. Grunt 0.4.x requires stable Node.js versions >=
0.8.0. Odd version numbers of Node.js are considered unstable development versions.