Swagger-editor: npm start error

Created on 24 Oct 2016  路  5Comments  路  Source: swagger-api/swagger-editor

I'm trying to get the editor to work locally. Followed the instructions on http://swagger.io/swagger-editor/,

git clone https://github.com/swagger-api/swagger-editor.git
cd swagger-editor
npm install
npm start

On the last command I get an error:

D:\Projects\swagger-editor>npm start

> [email protected] start D:\Projects\swagger-editor
> node server.js

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

Error: listen EACCES 127.0.0.1:8080
    at Object.exports._errnoException (util.js:1036:11)
    at exports._exceptionWithHostPort (util.js:1059:20)
    at Server._listen2 (net.js:1239:19)
    at listen (net.js:1288:10)
    at net.js:1398:9
    at _combinedTickCallback (internal/process/next_tick.js:77:11)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Module.runMain (module.js:592:11)
    at run (bootstrap_node.js:394:7)
    at startup (bootstrap_node.js:149:9)

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Progs\\nodejs\\node.exe" "C:\\Users\\apisit.Apis\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.7.0
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: `node server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'node server.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the swagger-editor package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs swagger-editor
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls swagger-editor
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Projects\swagger-editor\npm-debug.log

node: v.6.7.0
npm: v.3.10.8
OS: win7

question

Most helpful comment

@ljerka I think the important bit in the error is:

Error: listen EACCES 127.0.0.1:8080
    at Object.exports._errnoException (util.js:1036:11)
    at exports._exceptionWithHostPort (util.js:1059:20)
    at Server._listen2 (net.js:1239:19)

This error is basically saying that the server could not listen to port 8080 on 127.0.0.1. For me, this was because Apache was already using port 8080 (could also be Skype or some other program for you).

To fix this, I opened server.js and changed line 38 to:

var PORT = process.env.PORT || 8081;

All working now :)

It would likely be better to change process.env.PORT, but for the life of me, I couldnt figure out where that pulls from.

All 5 comments

I don't see this issue. Please try to remove the node_module and then npm install and npm start. This may solve your issue. Please let me know if you still have see this issue

Tried it few times already, it still gives me the same error.

I get the exact same error on windows server 2012. Worked fine on my Mac though :(

node v6.9.1
npm v3.10.8


0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 silly lifecycle [email protected]~prestart: no script for prestart, continuing
7 info lifecycle [email protected]~start: [email protected]
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\swagger-editor\node_modules\.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\cmd;C:\php;C:\php\ext;C:\Program Files\nodejs\;C:\Users\admin.smith\AppData\Roaming\npm
10 verbose lifecycle [email protected]~start: CWD: C:\swagger-editor
11 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'node server.js' ]
12 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
13 info lifecycle [email protected]~start: Failed to exec start script
14 verbose stack Error: [email protected] start: `node server.js`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:877:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd C:\swagger-editor
17 error Windows_NT 6.3.9600
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
19 error node v6.9.1
20 error npm  v3.10.8
21 error code ELIFECYCLE
22 error [email protected] start: `node server.js`
22 error Exit status 1
23 error Failed at the [email protected] start script 'node server.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the swagger-editor package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     node server.js
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs swagger-editor
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls swagger-editor
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

@ljerka I think the important bit in the error is:

Error: listen EACCES 127.0.0.1:8080
    at Object.exports._errnoException (util.js:1036:11)
    at exports._exceptionWithHostPort (util.js:1059:20)
    at Server._listen2 (net.js:1239:19)

This error is basically saying that the server could not listen to port 8080 on 127.0.0.1. For me, this was because Apache was already using port 8080 (could also be Skype or some other program for you).

To fix this, I opened server.js and changed line 38 to:

var PORT = process.env.PORT || 8081;

All working now :)

It would likely be better to change process.env.PORT, but for the life of me, I couldnt figure out where that pulls from.

@DelightedD0D You are right, changing the port value fixed the problem :)
I'm closing the issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

confuser picture confuser  路  6Comments

marcopiraccini picture marcopiraccini  路  3Comments

gnieutin picture gnieutin  路  4Comments

bluesh55 picture bluesh55  路  3Comments

alecmev picture alecmev  路  4Comments