angular-cli globally installation failure - angularjs

I am trying to install angular-cli globally but getting these errors.What to do?
C:\Users\Jahidul>npm install -g angular-cli
npm WARN registry Using stale data from http://registry.npmjs.org/ because the h
ost is inaccessible -- are you offline?
npm WARN deprecated angular-cli#1.0.0-beta.28.3: angular-cli has been renamed to
#angular/cli. Please update your dependencies.
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher
to avoid a RegExp DoS issue
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/micromatch failed, reason:
getaddrinfo ENOTFOUND registry.npmjs.org registry.npmjs.org:8080
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Jahidul\AppData\Roaming\npm-cache\_logs\2017-06-30T14_57_5
6_218Z-debug.log

If you follow the instructions mentioned on this site, you will find out that the command
npm install -g angular-cli
should be replaced by
npm install -g #angular/cli
which is also mentioned in the error. Retry using the new command.

The problem was my internet connection was not stable.Now everything is ok.

If you get the same error and you are behind a corporate network, then you need to change the config to add proxy as below:
Go to node.js install location in command prompt and type below command:
npm config edit --g
Add below lines at the end of the file:
registry=http://registry.npmjs.org/
strict-ssl=false
proxy=http://proxy.YOURCOMPANYNAME.com:8080
Then execute the npm install command:
npm install -g #angular/cli#latest

Related

npm ERR! code ERR_SOCKET_TIMEOUT on creating new React project when using npx create-react-app

I have tried npm clear cache but still whenever I try to run npx create-react-app, I get the following error (I have a good Internet Connection).
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
The issue was the npm version, I was using. I have used multiple solutions but the solution that worked for me was updating the npm version.
For Windows
npm update -g
For Mac
sudo npm install -g npm

Getting trouble to create a new react app

While I'm Tring to create a new react app I'm getting an error message below,
Installing packages. This might take a couple of minutes. Installing
react, react-dom, and react-scripts with cra-template...
npm ERR! code ECONNRESET npm ERR! errno ECONNRESET npm ERR! network
Invalid response body while trying to fetch
https://registry.npmjs.org/jest-resolve: aborted npm ERR! network This
is a problem related to network connectivity. npm ERR! network In most
cases you are behind a proxy or have bad network settings. npm ERR!
network npm ERR! network If you are behind a proxy, please make sure
that the npm ERR! network 'proxy' config is set properly. See: 'npm
help config'
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\Akhlak Hossain
Jim\AppData\Local\npm-cache_logs\2020-11-17T06_20_31_124Z-debug.log
Aborting installation. npm install --save --save-exact --loglevel
error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json Deleting new-react/ from
J:\learning_time_practices Done. npm ERR! code 1 npm ERR! path
J:\learning_time_practices npm ERR! command failed npm ERR! command
C:\Windows\system32\cmd.exe /d /s /c ""create-react-app" "new-react"
"--use-npm""
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\Akhlak Hossain
Jim\AppData\Local\npm-cache_logs\2020-11-17T06_20_31_497Z-debug.log
Can you try first this one npm config set registry http://registry.npmjs.org/? then try again to execute npx create-react-app [your_app_name]
There May be a problem with automatic proxy setup, try this out
go to settings> Network and Internet > Proxy
and then under Automatic proxy setup turn off Automatically detect settings on Windows. And then open a command prompt and type the following command.
npm uninstall -g create-react-app
It worked for me.
In my case, Antivirus was the culprit which was blocking some files at the time of npx operation. This helped my case

to install babel in windows

I want to install babel(windows). but I got error.How can I fix this?
Staff ~/Desktop/react
$ npm install --save-dev babel-core babel-loader babel-present-react
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/babel-core failed, reason: getaddrinfo ENOTFOUND proxy.company.com proxy.company.com:8080
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Staff\AppData\Roaming\npm-cache\_logs\2019-07-05T09_55_48_364Z-debug.log
First of all Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments.
so first you need to install node js then install npm package manager.
then install babel with this: npm install --save-dev #babel/core #babel/cli
or if you want to install react you can use "npm Create-React-App" is an officially supported way to create single-page React applications. by facebook

Error "rollbackFailedOptional" on create-react-app

I'm learning React. I got this 2 errors in the screenshots below (links) when running:
npm i -g create-react-app#1.5.2
Screenshots:
https://i.ibb.co/S7yszvz/Capture.png
https://i.ibb.co/4Y7LY6X/Capture2.png
The errors:
[..................] / rollbackFailedOptional: verb npm-session 8a15f24eef6f3714
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to https://registry.npmjs.org/create-react-app
failed, reason: connect ETIMEDOUT 10.21.30.247:80
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
What I tried:
npm config rm proxy
npm config rm https-proxy
npm config set registry http://registry.npmjs.org/
npm config get https-proxy (returns null)
I'm hoping for some help so I can make progress. Thanks
I finally did it using my phone network (must have been the firewall), but then:
C:\UserXXXX\Desktop\js REACT>create-react-app react-app
Creating a new React app in C:\UserXXXX\\Desktop\js REACT\react-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! code ENOTFOUND
npm ERR! errno ENOTFOUND
npm ERR! network request to http://registry.npmjs.org/posix-character-
classes/-/posix-character-classes-0.1.1.tgz failed, reason: getaddrinfo ENOTFOUND
registry.npmjs.org registry.npmjs.org:80
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\UserXXXX\AppData\Roaming\npm-cache\_logs\2018-12-
11T10_28_30_314Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting react-app / from C:\UserXXXX\Desktop\js REACT
Done.
I was facing similar issue a while back with npx create-react-app my-app as well.
So I reinstalled NodeJs and then tried removing proxy set up from npm config by following commands:
npm init
npm config rm proxy
npm config rm https-proxy
and then try the command npm i -g create-react-app#X.X.X again.

npm Unable to Install angular-cli

I am trying to install angular-cli via npm. I have the recent version of Nodejs and git installed. I am not behind any proxy server(verified it through netsh winhttp show proxy as well as through Internet Explorer LAN settings) and there is no problem with my internet connection. When i try to run
npm install -g angular-cli then I get the following error
C:\Windows\system32>npm install -g angular-cli
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "angular-cli"
npm ERR! node v7.3.0
npm ERR! npm v3.10.10
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT 151.101.192.162:80
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settin
gs.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! Please include the following file with any support request:
npm ERR! C:\Windows\system32\npm-debug.log
I tried cleaning the cache through npm cache clean and also tried to change the registry to http:\ via
npm config set registry http://registry.npmjs.org/
I also tried uninstalling nodejs and reinstalling it again but it is not working. I am getting the same error. Any ideas.
Setp-1: open windows command prompt then type following command to get the IP address of your proxy server
ping your-proxy-name
For example:
ping myproxy.xyz.com
Step-2: open Node.js command prompt and type following command
npm config set http-proxy http://your-proxy-ip-retrieved-in-step-1:port
npm config set https-proxy http://your-proxy-ip-retrieved-in-step-1:port
For example:
npm config set http-proxy http://192.168.192.95:8080
npm config set https-proxy http://192.168.192.95:8080
Setp-3: on Node.js command prompt type following command to install angular
npm install -g #angular/cli
Hope it will work for you.
Yes, this can be caused either by a firewall or a proxy. Can you ping the npm registry host and fetch a simple file?
> ping registry.npmjs.org
> npm view npm version
If the ping is not successful, check your connection or disable your firewall.
Future viewers: Try below approach (it worked for me)
Go to nodejs installed location (path may be different in your case)
C:\Program Files\nodejs\node_modules\npm
Add below entry in the npmrc file then save it
strict-ssl=false
Then try installing angular cli
npm install -g #angular/cli
This kind of issues usually happen when you are behind a proxy or a firewall that blocks npm from fetching the requested packaged.
If you know your proxy address and port, open a console and set your HTTP_PROXY and HTTPS_PROXY variables before running npm, as follows:
set HTTP_PROXY = "http://<proxy server name or IP address>:<proxy port>"
set HTTPS_PROXY = ... ;same as above
npm install <package_name>
I faced similar issues and figured that we need to combine the proxy and the install command together like below and it worked for me. Hope it works for you people. Thanks!!
npm --proxy http://username:password#proxyURL:port install -g #angular/cli --without-ssl --insecure
You need to override your proxy settings to install angular CLI.
Try executing below command :
npm config set registry http://registry.npmjs.org/
This will override your proxy and you do not need to make any changes to your connections or firewall. Once this command executes successfully try installing angular CLI using below command:
npm install -g #angular/cli
Refer this link for more details on this.
This solved problems for me. Hope this helps!

Resources