npm install connect issue - angularjs

I am new to node.js. I have been undergoing Angular.js Pro by Adam Freeman
As per the installation step:
I need to setup the web server for angular.js application using nodejs.
Accordingly i installed node.js version 6.11.0 in the path:
C:\Program Files\nodejs
Next step is to install connect module of nodejs using the command npm install connect.
I am getting the below error message when doing so.
shell output here
Can please anybody help with this.

You don't have to do that in the node.js path.
You can head over to a new directory say ~/desktop/temp
And then first do npm init, which would set the project to use npm. It would ask a couple of questions.
Post this, do npm install connect

Well, you need to start clean in an empty folder of your choice. This will be your project folder.
cd into it, then run npm init
Now you're ready to npm install whatever packages you need.

Related

npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)

When I want to create a react app I'm encountering the following error:
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/react-is (over 30000ms)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\info\AppData\Roaming\npm-cache\_logs\2020-04-23T02_54_45_865Z-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 app2/ from C:\Users\info
Done.
Sounds like you have a slow connection. Try increasing the timeout from 30s to 60s by adding this to your .npmrc file:
timeout=60000
You could also try adding
prefer-offline=true
if you are trying to save bandwidth or have a slow connection
Note: if you don't have an .npmrc file setup yet, you can create one here
for Windows: C:\Users\{username}\.npmrc
for Mac/Linux ~/.npmrc
Or you can create one in the same directory as your project's package.json file.
I had a slow connection and I updated the timeout value to .npmrc using:
npm set timeout=100000
And to check if the value is updated (Mac): vi ~/.npmrc
Users are extremely likely to face this issue if they are on a slow internet connection. To counter this, you need to increase the timeout in the npm's config file. And here's how to do it:
Find the .npmrc file (located in the nodejs installation folder; in my case, it's in F:\Installations\nodejs\node_modules\npm folder. But for you, it might be in C:\program files folder).
Open the .npmrc file and append this line: timeout=240000 (usually it is 60 seconds I suppose, but since my connection was way slower therefore, I had to increase it to 240 seconds or 4 minutes, you can keep it 120000 for 120seconds)
Save the file
Since create-react-app fails midway, it can easily break npm's package.json file thus leading to this sort of issue:
Unexpected end of JSON input while parsing near
Therefore, before running the npx create-react-app, run the following command: npm cache clean --force as it cleans the cache and (i think) repairs the package.json file.
I was facing the same issue. I Solved it like this:
create a new file with no name just an extinction of .npmrc
open this file in any editor and type timeout = 90000
save the file and in you terminal type
npm cache clean --force
npm install create-react-app
npx create-react-app ./
Note: this error occurs because of slow internet speed
This error occurs due to slow internet connection. Try installing when you get a better speed. If better speed doesn't solve your problem try this.
npm cache verify
npm cache clean --force
I enabled IIS and the issue was solved for me:
do to Control Panel -> Programs -> Programs and Features
click on Turn Windows features on and off
make sure the Internet Information Services is checked
click OK and wait for some minutes
I was facing the same issue when create a react-app using npx create-react app . And i fixed my problem by running the following command.
npm cache clean --force
I hope you find this helpful
I fixed the problem by setting timeout in user local .npmrc file to
timeout=600000
90000 is not enough for downloading many packages for projects with lot dependencies in package.json
In case you are still running into this issue below with the error:
Invalid response body while trying to fetch
https://registry.npmjs.org/eslint-config-react-app: Socket timeout
Run this script: npm install react --registry=https://registry.npmjs.org
and then npx create-react-app mypp
for your react app installation. Happy coding
I fixed the problem by running:
npm config set registry "http://registry.npmjs.org" --global
It appears the problem is related to the following post:
npm install gets stuck at fetchMetadata
And #CptUnlucky's solution worked for me on macOS Catalina 10.15.7, node v16.0.0, npm v7.12.2, nvm v0.38.0
I was facing the same issue and I solved it by enabling the Internet Information service (IIS) feature of the window.
Enabling the IIS
Steps:
Windown + r
Type appwiz.cpl and click OK
click on Turn window features on or off (on the Left top side)
wait some seconds and check the Internet information service option
Now wait until window apply changes.
create project again.
I have faced the same issue. I tried all solutions over StackOverflow or Github discussions but nothing worked.
I changed the .npmrc file under the Users folder in C in Windows and changed the timeout from 30000 to 90000. See if 60000 works!
In my case it was the issue related to npm verison 6.14*
Downgrading to npm verison 6.13.7 solved for me
npm i -g npm#6.13.7
It's also an newly opened issue
you can check more details about it at
https://github.com/npm/cli/issues/1185
You just need to run npm i npm#6.13.7 or npm I -g npm#6.13.7 if you wanna this to be global version.
After that, just to make sure, run " npm -version " to see what version you are using.
Downgrading to npm version 6.13.7 worked for me.
Try this:
npm cache clean --force
npm config rm proxy
npm config rm https-proxy
And remove your node_modules within your user.
In Windows, it is
C:\Users\${select_your_user}\AppData\Roaming\npm\node_modules
I was facing the same issue when running npm install on Docker.
I had to pass the HTTP and HTTPS proxy values to the image while building it.
docker build --build-arg HTTP_PROXY=http://<your_company_proxy> --build-arg HTTPS_PROXY=http://<your_company_proxy>
It worked fine after I passed these parameters.
In my case it was the issue related to npm verison 6.14*
Downgrading to npm verison 6.13.7 solved for me
npm i -g npm#6.13.7
It's also an newly opened issue you can check more details about it at https://github.com/npm/cli/issues/1185
it is works for me
Editing the .npmrc file to 80000 works. If not, globally uninstall create-react-app:
"npm uninstall -g create-react-app" then run "npx create-react-app ./"
I recently have the same issue and following steps would help you.
npm config set registry "http://registry.npmjs.org" --global (sets registry) (Try Again)
Go to you user folder find .npmrc file there and remove content of it.
run npm cache clean --force
still errors - Remove the content of npm base folder usually inside User/AppData/roaming/npm/...
I tried everything including factory resetting my Mac. Then after reinstalling everything and still having the same issue, I typed into the terminal and ran:
npm set timeout=100000
then sat my computer next to my router and ran npx create-react-app again and it worked!
Sometimes it won't work if you use only letters in your app name e.g first I have used "myapp" and that was not working though I have done all the other stuffs correctly like set timeout = 240000 in .npmrc file and run the following commands
npm cache clean --force
npm install create-react-app
npx create-react-app myapp
but that not working for me then I have just changed my project name from myapp -> my-app and it worked perfectly. So, If you are facing the same issue try them out. Hopefully, it saves your time.
I tried many things for 3 days, then i figure out that new versions of nodejs doesn't work so fine for some computers, i downgrade to 16.0.0 and then worked
Regarding npx ...
If you have create-react-app (CRA) globally installed;
it is recommend you uninstall CRA
to ensure that npx always uses the latest version.
When using npx, the global installation isn't used.
But it may interfere (addressed below).
Don't run your React app from your desktop.
Some operating systems may throw an error.
Windows OS users ...
As administrator (for steps #1 & #2), inside your command-line ...
1) uninstall your global version of CRA.
npm uninstall -g create-react-app Mac prefix: sudo
2) Then ...
Run: npx create-react-app my-app Mac prefix: sudo
Above: This will create the latest version of
a React app named: my-app.
This app will be created wherever your command-line is pointing.
3) Open Google Chrome.
4) cd my-app (point your command-line to your project folder).
5) inside your command-line ... Run: npm start

Failed at the grpc#1.20.0 install script. while installing react

I am having a hard time installing React Theme. The problem is when I downloaded the theme and extracted it and went to the root directory...then tried to install it by running this command npm install.
it gave this error
Failed at the grpc#1.20.0 install script.
the error log was like this:
After whole hours I find a hint from Github saying the problem was installing firebase which basically has grpc in them.
So what I did was to disable the antivirus or windows defender, whatever you have in your pc, and boom it will install safely.
this was the link I referred to https://github.com/grpc/grpc-node/issues/121

Can't create WebStorm React project

I'm trying to create a React project in WebStorm 2016.3.1
It's asking me for a create-react-app but I have no idea what that is and I can't find any reference on Google.
What is it and where can I find the value?
You need to install create-react-app npm module, before you use this feature.
npm install -g create-react-app
You can read more about this feature on the official release blog of WebStorm.
Excerpt from the documentation :
Make sure that you have create-react-app installed globally on your computer, for that run npm install -g create-react-app. Then to start your new project, double click on the start task in the npm tasks tool window to run it. That’s it!
I had ie installed create-react-app globally using yarn and webstorm failed to find it. Then I used npm, not to mention globally and its working like a charm.
TL;DRNo need to install anything. Just enter npx create-react-app in the create-react-app field & it should work like a pycharm, I mean charm :)
Side note: npx is pre-bundled with npm since npm version 5.2.0.
I created webStrom react app following this steps.
Download node.js
Open command line console and type "npm install -g create-react-app"
Create react app project from web-storm.
Make sure you provided the correct file path of create-react-app , by default it is
installed in ~\AppData\Roaming\npm\node_modules\create-react-app
use
npm start: to start development server
If you are using asdf or any other tool to manage multiple versions of nodejs, you will need to set up the path to create-react-app manually
I'm on mac, so for me the path was
/Users/<USER>/.asdf/installs/nodejs/12.16.2/.npm/lib/node_modules/create-react-app

How can I run my bower-angular project?

Hi everyone I know its simple question but I am new the angular development.
I have angular projects but I cant run.
I know npm using on console, I tried many times npm run, npm instal on my main directory.
So, how can I run my angular project on the console?
If the project is using Angular Seed or is similarly configured, you can use
npm start
to install dependencies and start a running http-server on port 8080 (by default).
If you project has a README or package.json file, it might give more clues.
Otherwise you can just serve up the application with http-server:
npm install http-server
http-server .
Asume you are using NodeJS as a server side, try node [your-application-main-js-file.js]. For example node index.js. But it depends on what back end environment are you using. Angular is just a front end library/ framework. It should be tested on browser not in your console.

What is causing 'grunt serve' to throw 'No Bower components found'?

I am starting out angular app with angular-fullstack in my Windows 7 box. I installed bunch of npm packages with -g options, including grunt-bower-install. I created the application first by running
yo angular-fullstack appname
There were no exception during the application creation. After application was created successfully I tried to run the app using
grunt serve
expecting the server to run. But the 'grunt serve' failed with
Running "bower-install:app" (bower-install) task
Cannot find where you keep your Bower packages.
We tried looking for a .bowerrc file, but couldn't find a custom
directory property defined. We then tried bower_components, but
it looks like that doesn't exist either. As a last resort, we tried
the pre-1.0 components directory, but that also couldn't be found.
Unfortunately, we can't proceed without knowing where the Bower
packages you have installed are.
Fatal error: No Bower components found.
I did find .bowerrc file and it was pointing to app/bower_components. Unfortunately, bower_components file was no where to be found. I am not sure what should be the content of the file to create it myself. Is it the missing file causing this problem or is there a npm package, I did not install correctly?
I installed bower using npm as well *
Thanks
Confusingly, the grunt-bower-install task that comes with angular-fullstack doesn't install bower components. It doesn't install anything. This error is trying to let you know that it can't find the bower_components directly, so it can't do its thing.
To fix the issue, run bower install.
If you don't have Bower installed, run npm install -g bower first.
I had the same issue, here's what worked in my case:
installed ruby and compass (yeoman needs these)
verified that path to Ruby bin folder is added to %PATH%
installed Git
restarted cmd window and ran "bower install" in the app folder
After that, grunt serve command worked perfectly.
Note: maybe installing Git and running bower install would suffice in your case.
I faced the same problem but only did npm install -g bower and then bower install and got grunt serve working.
I did not need to do any of the things mentioned by Olga.
Hope this helps.
npm install -g bower doesn't install bower components, you should run as well bower install to have all bower's components installed and then run grunt serve. It should work fine
Try to do bower install. If its failing saying not able to connect to git then you can change repo pointing location by simply running below command
$ git config --global url.https://github.com/.insteadOf git://github.com/
This will ensure that you will be downloaded over https instead of git if its causing orginasation firewall to block it.
In my case, I added sudo for it to work. So, I ran sudo npm install -g bowerand then bower install. grunt serve then worked when I ran it.
The Bower installation requires the packages to be brought from the Git repository, so first you need to install the Git application in your system. You can download it from this link :https://git-scm.com/downloads . Now after your have downloaded it , there may be a chance that the PATH may not be set up, so go to ControlPanel -> System and Security -> System -> Advance System Settings (on the left-hand side), click it, then goto Environment Variables -> System Variables -> PATH , click edit , and write down the following paths :
;C:\Users\admin\AppData\Local\Programs\Git\bin;
C:\Users\admin\AppData\Local\Programs\Git\cmd ....Well the above path is where Git was installed in my system, you can crawl to the place in your system where Git was installed and select the paths from the "bin" and "cmd" folder and paste it on the PATH variable.
Now, after the GIT path is setup, you can now type in the command " $ bower install " , this will install all of your bower packages.
npm install -g bower
bower install
grunt serve
worked for me ...
npm install -g bower
bower install
grunt serve
It's worked too

Resources