npm Unable to Install angular-cli - angularjs

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!

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

angular-cli globally installation failure

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

i am new to angularjs 2 framework.i need help to understand this

How can i integrate angularjs 2 framework to my django project where i have used bootstrap.please help if you are good in angularjs 2 and bootstrap.thank you.
how to use this because on my side its not working
npm install -g angular-cli and npm install -g #angular/cli
ng new project-title
cd project-title
ng serve
this the error i am getting when i use these commandsnpm install -g angular-cliand npm install -g #angular/cli
Microsoft Windows [Version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\harrugg>npm install -g #angular/cli
npm ERR! Windows_NT 6.1.7600
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.8.0
npm ERR! npm v4.2.0
npm ERR! Cannot read property 'path' of null
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Windows_NT 6.1.7600
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.8.0
npm ERR! npm v4.2.0
npm ERR! code ECONNRESET
npm ERR! network socket hang up
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:\Users\harrugg\AppData\Roaming\npm-cache\_logs\2017-04-11T10_40_5
6_491Z-debug.log
strong text
As you know angular 2 is a component based frontend framework to build a single page web application. To integrate angular2/4 with Django. Create a restful API with Django and Django restframework and consume those API endpoints with angular2. That is the best and recommended way to work with Django and angular2.
For instance, if you have multiple Django application you can create on of your app to angular based on other normal Django app.
You can create a folder structure like this as shown below.
Here is the link that can help you to get started with Django and angular 2.
https://4sw.in/blog/2016/django-angular2-tutorial/
Regarding your installation error, it has been already answered in stack overflow as I believe error is with the npm itself not with angular2
Check whether package.json is in your working directory
if not create it by using npm init and try to install angular2 by using npm install #angular/cli command.
If this process didn't work. I think that the issue with npm. This link will help you to debug npm problem.
check this link. Windows 7, npm install -g react-native-cli gives "Cannot read property 'path' of null"
i have refereed to this link and it have the installation problem.this is the procedure [https://github.com/npm/npm/issues/15348)
use the following commands .
npm config set proxy proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
npm config set proxy null 4npm config set https-proxy null
npm config set strict-ssl false
you can check your network connection in case of proxy problem when using npm using the following commands
npm config get registry
npm config get http-proxy
npm config get https-proxy

Resources