to install babel in windows - reactjs

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

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

npm ERR! A complete log of this run can be found in: npm ERR! Aborting installation. npm install --no-audit --save --save-e

PS E:\React> npx create-react-app task
Creating a new React app in E:\React\task.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
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'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\santo\AppData\Local\npm-cache_logs\2022-02-15T06_08_33_703Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting task/ from E:\React
i'm gettibg this msg can anyone help me
Try again with better connectivity. Because npx fetch data from server which required network connection Once you successfully generate project you can work without network connection.

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.

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