Run vue project getaddrinfo ENOTFOUND localhost error - npm

I have initialized a nuxt project and when I try to run it with npm run dev or yarn dev command it returns this error :
build [================== ] 91%Error: getaddrinfo ENOTFOUND localhost
at errnoException (dns.js:50:10)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
error Command failed with exit code 1.
Any idea where does it come from ?

add 127.0.0.1 localhost to /etc/hosts

Check if there is already any service running on that host and port. In my case, I was trying to run it on port 80 while nginx is started.

Related

Getting error using npm install from repository cloned from bitbucket?

getting error - request to https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz failed, reason: getaddrinfo ENOTFOUND (proxy server)?
I have set up my proxy variable correctly also set up the global config as well. when i do npm config list it also displays the proxy set up by me. This is how my npm config file looks like

Why does npm start gives me an error about the port?

I do not know why it gives me error after I type "npm start". I'm trying to open my React Native project using same WIFI. I think it is about the port.
This is the error:
Loading dependency graph...events.js:183
throw er; // Unhandled 'error' event
^
Error: listen EADDRINUSE :::8081
at Server.setupListenHandle [as _listen2] (net.js:1360:14)
at listenInCluster (net.js:1401:12)
at Server.listen (net.js:1485:7)
at D:\rnprojects\testproject\node_modules\metro\src\index.js:156:18
at new Promise (<anonymous>)
at Object.<anonymous>
(D:\rnprojects\testproject\node_modules\metro\src\index.js:155:12)
at Generator.next (<anonymous>)
at step (D:\rnprojects\testproject\node_modules\metro\src\index.js:47:262)
at D:\rnprojects\testproject\node_modules\metro\src\index.js:47:422
at <anonymous>
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! testproject#0.0.1 start: `node node_modules/react-native/local-
cli/cli.js start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the testproject#0.0.1 start script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ASUS\AppData\Roaming\npm-cache\_logs\2018-09-
29T06_20_58_251Z-debug.log
After npm start:
Probably port is already in use. I face similar issue when i first run react-native run-android and then npm start. I solve it like this:
First, get the id of the process running in port 8081:
sudo lsof -i :8081
then kill it:
kill -9 ID_SHOWN_FROM_PREVIOUS_CMD
ID_SHOWN_FROM_PREVIOUS_CMD will be something like 25534
So after it, first run npm start and then react-native run-android
Find the port:
netstat -a -n -o | find "8081"
You need to find the pid. Second step, kill that:
taskkill /PID 5952 /F
In this case the pid is "5952".
Run command in terminal:
lsof -n -i4TCP:8081 | sed '1 d' | awk '{print $2}' | xargs kill -9
IN my case the process running on 8081 is required and cannot be killed.
So I changed the port of Native app itself
Set another port
react-native start --port=8088 # any other port you like
Then change all the instance of 8081 to 8088 in project.pbxproj
i.e
node_modules/react-native/React/React.xcodeproj/project.pbxproj
Also Open project in Xcode, search for 8081 and replace with 8088.
Rebuild the project again.
This is how I resolved by issue.
lsof -i :PORT_NUMBER //To find the PID
kill -9 PID
npm start
On a mac/ubuntu, run the following command to find id of the process which is using port 8081
**sudo lsof -i :8081**
you are performed this operation got one PID here. Just copy and paste in next process
Then run the following to terminate process:
**kill -9 23583**
example: PID = 23583
thats all. Enjoy your coding

Unable to start hyperledger fabric network with hyperledger composer

I am currently working on HyperLedger composer v1.1 on Ubuntu Virtual Machine (16.04 LTS) hosted in remote server and using VMWare Vsphere client to connect to that host machine. My PC (Windows 7) and the hosting server are in the same LAN.
In fact, I am following the tutorial (https://hyperledger.github.io/composer/latest/tutorials/developer-tutorial).
I managed to install the chaincode onto the network but when I tried to start the business network using the command :
composer network start --networkName tutorial-network --networkVersion 0.0.1 --networkAdmin admin --networkAdminEnrollSecret adminpw --card PeerAdmin#hlfv1 --file networkadmin.card
I got this error :
✖ Starting business network definition. This may take a minute...
Error: Error trying to start business network. Error: No valid responses from any peers.
Response from attempted peer comms was an error: Error: 2 UNKNOWN: error starting container: Failed to generate platform-specific docker build: Error returned from build: 1 "npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/composer-runtime-hlfv1 failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443 ...."
Then, when I saw the suggestion of #PaulO'Mahony at "hyperledger-composer v1.1:unable to instantiate chaincode"
I tried to locate the npmrc file but it was not there then I did as #oligofren suggested at Node .npmrc file.
After that, I have executed this command :
composer network install --c PeerAdmin#hlfv1 --a tutorial-network#0.0.1.bna -o npmrcFile=/home/user1/.npmrc"
where ".npmrc" file is generated after I have logged in (using npm login).
Finally, when try to execute the above command "composer network start...." the same error is still exist !!!
Note that : I have executed "./stopFabric.sh", "./teardownFabric.sh" and then "./startFabric.sh" before I did each solution!

NPM and YARN not installing packgaes

While installing any package
yarn is giving error
info There appears to be trouble with your network connection. Retrying...
I visited the https://registry.yarnpkg.com it gave
{"db_name":"registry","doc_count":889991,"doc_del_count":342,"update_seq":11137048,"purge_seq":0,"compact_running":false,"disk_size":13042010533,"data_size":5649135494,"instance_start_time":"1527001930076866","disk_format_version":6,"committed_update_seq":11137047}
Moreover npm is giving the
Error: tunneling socket could not be established, cause=connect
ECONNREFUSED 127.0.0.1:80
using no proxy

npm install work but jspm not

I'm working on an Aurlia.io project. Suddenly the jspm stopped working.
If I retry running the command jspm install, I get an error that a different package failed to load.
warn Error on lookup for npm:babel-runtime
Error: connect ECONNREFUSED 151.101.12.162:80
at Object.exports._errnoException (util.js:873:11)
at exports._exceptionWithHostPort (util.js:896:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1077:14)
err Error looking up npm:babel-runtime.
Does anyone have an idea?
#Eliav Maman has the answer in his comment:
Problem solved! just go to edit system environment variables and add
to new user variables 1.HTTP_PROXY= your proxy
2.HTTPS_PROXY=your proxy with https
I'm trying to get this question marked as answered.