G
G
Gagatyn2019-08-26 00:22:54
Node.js
Gagatyn, 2019-08-26 00:22:54

Why does node-static give permission denied: port?

Hello!
Decided to get into webpack. A simple static server wanted to run, the node-static module.
Since there were no modules, I registered these:

npm i -g webpack
npm i -g node-static

Everything downloaded, everything is fine.
I write staticin cygwin, the output is:
[email protected] /cygdrive/a/webpack
$ static
serving "." at http://127.0.0.1:8080
events.js:174
      throw er; // Unhandled 'error' event
      ^

Error: listen EACCES: permission denied 127.0.0.1:8080
    at Server.setupListenHandle [as _listen2] (net.js:1262:19)
    at listenInCluster (net.js:1327:12)
    at doListen (net.js:1460:7)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
Emitted 'error' event at:
    at emitErrorNT (net.js:1306:8)
    at process._tickCallback (internal/process/next_tick.js:63:19)
    [... lines matching original stack trace ...]
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Error: listen EACCES: permission denied 127.0.0.1:8080

Googled it. Found the answer. To fix, you need to change the port towebpack.config.js
//webpack.config.js
module.exports = {
    entry: './home',
    output: {
        // path: __dirname + '/dist',
        filename: 'build.js'
    },
    devServer: {
        historyApiFallback: true,
        port: 8080 //<-- вот эта строка и добавил свой порт
    }
}

Repeated. I am writing staticbut still denied permission
Tell me what to do?
Maybe the problem is in the directory path itself, a conflict of Russian characters? -The user (I) is registered in Cyrillic, but it takes a long time to change :(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Mikhailov, 2020-12-29
@EvgenyMikhaylove

I’ll write my answer, although the question is very old, and the author has probably studied Webpack up and down for a long time. And he does not need this answer. But maybe someone will come in handy.
And I have the same problem now with this static. I'm apparently now going through the same Webpack screencast that the author of this question was going through when he asked this question.
So, my problem is solved by changing the port for a static server. From 8080 to some other. And I did it in the console like this:
static --port 3001
And it all worked.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question