0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

npm run devの実行時にthrow er; // Unhandled 'error' eventのエラーが出る時の対応

Posted at

実際のエラー

events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: listen EADDRNOTAVAIL 10.102.158.22:3000
    at Object._errnoException (util.js:992:11)
    at _exceptionWithHostPort (util.js:1014:20)
    at Server.setupListenHandle [as _listen2] (net.js:1338:19)
    at listenInCluster (net.js:1396:12)
    at GetAddrInfoReqWrap.doListen [as callback] (net.js:1505:7)
    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

解決策1

/etc/hostsのlocalhostが書き換えられているので、戻す

sudo vi /private/etc/hosts

127.0.0.1 localhost
に戻す

解決策2

既存のプロセスが立っていないかチェック。他で既にlocalhostが立っていたらそれをキルする

$ ps aux | grep node

$ sudo kill -9 ポート番号
$ npm run dev

解決策3

node_modulesの依存関係に問題があるかもしれないので、npm install を再度行う

ls
# package.jsonがある階層までいく
rm -r node_modules
rm package-lock.json
npm install
npm run dev
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?