Can't install grunt-cli but can install bower - node.js

I have a linux box behind a no auth proxy.
I have configured git to use https instead of git.
url.https://.insteadof=git://
I have set my http_proxy and https_proxy environment variables and also the npm proxy.
; cli configs
user-agent = "npm/3.8.6 node/v6.0.0 linux x64"
; userconfig /jenkins/.npmrc
https-proxy = "{host}:8060"
proxy = "{host}:8060"
I can install bower with:
npm install -g bower
but when i try
npm install -g grunt-cli
i get:
npm ERR! fetch failed https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz
npm WARN retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=connect EINVAL 0.0.31.124:80 - Local (0.0.0.0:0)
....
npm ERR! network tunneling socket could not be established, cause=connect EINVAL 0.0.31.124:80 - Local (0.0.0.0:0)
I have tried with npm version
3.8.6 / 2.15.1
Any ideas why i can install bower and not grunt-cli from same account in same session (i can even install grunt globally, and clone grunt-cli)?
UPDATES
1: I am able to do
curl -O https://registry.npmjs.org/grunt-cli/-/grunt-cli-1.2.0.tgz
with success, the npm https-proxy is equal to $https_proxy value.

The problem was my npm proxy was host:port, without the "http://" prefix. like the environment variable. works now.
I have no idea why bower installed though.

can you try
npm install -g grunt-cli
this looks like a network problem with your proxy configuration.
Update to the latest version of node and npm, and use the correct proxy settings.

Related

Got stuck at npm in 'sill idealtree build'

I can't install anything using npm and already tried everything I found online. Please, anyone can help me with that?
Using:
Kubuntu 22.10
Node 18.7.0
npm 8.18.0
I tried:
uninstall & reinstall node and npm
set wi-fi connection to link-local in IPv4 / IPv6
delete package-lock.json
disabling SSH
npm i registry.npmjs.org
npm set progress=false
npm config rm proxy
npm config rm https-proxy
npm config set registry http://registry.npmjs.org/
sudo npm install -g npm#latest
npm cache clear --force
npm cache verify
git config --global http.proxy https://proxy-server:port
Any thoughts?

Request to http://registry.npmjs.org/check failed, reason: connect ECONNREFUSED

When I run this commend "npm install -g check" on cmd I have the following error
npm ERR! code ECONNREFUSED
npm ERR! errno ECONNREFUSED
npm ERR! FetchError: request to http://registry.npmjs.org/check failed, reason: connect ECONNREFUSED 10.141.0.60:80
using:
OS: Windows 10
Node Version: v8.10.0
npm version: 5.6.0
Domain (AD): kmsd
User: mu789
Proxy: 10.40.140.60:4000
I tried following commends, but still have the same issue
npm set strict-ssl=false
npm config set registry "http://registry.npmjs.org/"
npm config set proxy http://kmsd\mu789:ab_132#10.40.140.60:4000/
npm config set https-proxy http://kmsd\mu789:ab_132#10.40.140.60:4000/
--
npm config set proxy http://kmsd%5Cmu789:ab_132#10.40.140.60:4000/
npm config set https-proxy http://kmsd%5Cmu789:ab_132#10.40.140.60:4000/
--
npm config set proxy http://mu789:ab_132#10.40.140.60:4000/
npm config set https-proxy http://mu789:ab_132#10.40.140.60:4000/
--
.npmrc
proxy=http://kmsd\mu789:ab_132#10.40.140.60:4000/
https-proxy=http://kmsd\mu789:ab_132#10.40.140.60:4000/
--
.npmrc
proxy=http://"kmsd\mu789:ab_132"#10.40.140.60:4000
https-proxy=http://"kmsd\mu789:ab_132"#10.40.140.60:4000
--
.npmrc
proxy="http://kmsd\mu789:ab_132#10.40.140.60:4000/"
https-proxy="http://kmsd\mu789:ab_132#10.40.140.60:4000/"
I tried all methods in Is there a way to make npm install (the command) to work behind proxy? but still have the issue.
format for proxy "http://mu789:kmsd#10.40.140.60:4000" which should be put in .npmrc file.
Please try this and check if you still face this isue.
Assuming kmsd is password for the corp
I had the same issue, was able to successfully install it outside my company's corporate network or try adding the proxy to proxy bypass list. Hope it helps!

Miscellaneous Warning ECONNRESET while setting up vue app

I am trying to set up vue app by vue-cli. Everything went well until I typed
npm install
to install dependencies. It was an error with https so I changed it to http
but then I get this log:
npm WARN registry Unexpected warning for http://registry.npmjs.org/: Miscellaneous Warning ECONNRESET: request to http://registry.npmjs.org/debug failed, reason: socket hang up
npm WARN registry Using stale package data from http://registry.npmjs.org/ due to a request error during revalidation.
I also used
npm config rm proxy
npm config rm https-proxy
and still had the same issue.
Manually change https to http
npm config set registry="http://registry.npmjs.org/"
npm config set strict-ssl false
if you are behind proxy else ignore this
npm config set proxy http://username:password#10.80.81.180:80
npm config set https-proxy http://username:password#10.80.81.180:80
Install vue-cli
npm install -g vue-cli
Setup vuejs project
vue-init webpack-simple vueproject
Install dependencies
npm install
Now your vuejs boilerplate project setup is complete
Update #1
First clear npm cache and then try the above steps
npm cache clear --force

Installing npm package fails with 404

Using the command prompt, I am trying to install angular CLI and it fails. I have npm version 5.5.1 and node version v8.9.1. I am trying to install angular cli using the command
npm install -g #angular/cli#latest
and it fails with the error:
npm ERR! code E404
npm ERR! 404 Not Found: #angular/cli#latest
npm ERR! A complete log of this run can be found in:
I look at the log file and I see its trying to fetch the package from a location that doesn't exist. Not sure from where it gets pulled. How do I fix this location path and install angular cli. Same happens when I try to install typescript or any other npm package. all of them try to install from the location mentioned below and it fails with 404
8 http fetch GET 404
http://nuget.feed.xyz.corp:8729/npm/FeedNPM/#angular%2fcli 109ms
9 silly fetchPackageMetaData error for #angular/cli#latest 404 Not Found:
#angular/cli#latest
10 verbose stack Error: 404 Not Found: #angular/cli#latest
npm config set registry http://registry.npmjs.org
NPM registry documentation
Try first this commands (in windows run as administrator)
npm config set registry http://registry.npmjs.org
npm install -g #angular/cli
if still not working let's update NPM and nodejs by running this commands
npm -g install npm
npm cache clean -f
npm install -g n
then try to run
npm install -g #angular/cli
This should solve this problem
in my case it was .npmrc file in my project dir, which kept overwriting my global registry url. As soon as I deleted it, I could finally use npm install
Add a .npmrc file in the root of the project. .npmrc will look like below -
#xy:registry=https://xyz.jfrog.io/xyz/api/npm/npm-local/
#xy-app:registry=https://xyz.jfrog.io/xyz/api/npm/npm-local/
And Delete all the field eg - email , auth etc.
Find out what is the registry url of your application and put it into the registry.
Then run command - npm install
And it will work.
It was giving the same error for me when I use office network/vpn as they have 'umbrella' DNS security shield. To solve this issue, connect to personal network and type the below commands:
npm config set registry http://registry.npmjs.org
npm install -g #angular/cli
Alternative, another option to avoid 404 npm error
check if your terminal is in the root directory, if not your npm scripts will not execute
because it will not be able to see the package.json
I had same problem with a private package.
Need to:
npm adduser
npm login
I spent hours on this.
I had to follow the below steps to get it to work (mac).
Delete my LOCAL (not project) .npmrc by running:
rm /Users/<NAME>/.npmrc
Then set the registry:
npm config set registry https://registry.npmjs.org/
Then follow the steps for logging in to npm:
npm login
Check what's in your config list by running:
npm config list
It should look like this:
//registry.npmjs.org/:_authToken = (protected)
registry = "https://registry.npmjs.org/"
Hope it works for you too.
change your access level to public. type this in the terminal
npm --access=public
install your angular.
sudo npm install #ngular/cli
In my case, that's a typo error:
change trct-js-sdk to trtc-js-sdk saved my life.
My solution was as follows because I had a dependency on a private package. If you see the dependency in package.json defined in the format #scope/package, then #scope tells you that it's a scoped package that might be private.
Get the private package owner to grant you access to the package
Upgrade npm
Upgrade node
Add registry using HTTPS (not HTTP), e.g. npm config set registry https://registry.npmjs.org
Do "npm login"
Now run the build
Uninstall NPM & nodejs and install the right way NPM (Ubuntu)
sudo with npm is not recommended
To Uninstall
sudo apt-get remove nodejs
sudo apt-get remove npm
or
sudo apt-get purge nodejs
Followed by proper installation
curl -o-
https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
To confirm open a new terminal run:
$ command -v nvm
Latest LTS release of NodeJS:
$ nvm install --lts
Set default environment
$ nvm alias default lts/*
Worked for me
I got
error 404 'dotnev#*' is not in this registry.
Deleted .npmrc file in 2 folders back over my project root
and then in the project root folder typed:
npm i dotenv
copied from:
https://www.npmjs.com/package/dotenv
Just run sudo npm config set registry http://registry.npmjs.org and then update your npm.
It is an network error , check your network connection and try to install it again.
the only command line "npm -g install npm" solved the issue for me!
the following link can be helpful to dig deep for a better understanding.
Thanks a lot.

How to install anything using npm install under a proxy

I'm trying to use the following tutorial to learn ReactJS: http://www.tutorialspoint.com/reactjs/reactjs_environment_setup.htm
I'm on a corporate network, so I'm under a proxy, hence I cannot install anything using npm install.. I need to do the following: npm install -g babel; npm install -g babel-cli; npm install webpack --save; npm install webpack-dev-server --save; npm install react --save etc.. So, how do I do that under a proxy?
These are plenty of examples to use npm with proxy. You may want to take a look of these:
Using npm behind corporate proxy .pac
https://jjasonclark.com/how-to-setup-node-behind-web-proxy
Generally, you can just run those commands to use an HTTP proxy:
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
Else, if you are using Mac and want to use SocksV5 proxy, this is your command (Source: https://github.com/npm/npm/issues/6204):
ALL_PROXY=socks5://127.0.0.1:5000 npm install anypackage -g

Resources