我试着用快车监听端口:
const http=require('http'); const PORT_=process.env.PORT||7000; const express=require('express'); const app=express(); app.use((req,res,next)=>{ res.send("Hellow world"+PORT_); next(); app.listen(PORT_,(err)=>{ err===true ? console.log(err):console.log('run on '+port_); });
当我在任何端口上运行程序时,得到以下错误:
node:events:498 throw er; // Unhandled 'error' event Error: listen EACCES: permission denied :::7000 Emitted 'error' event on Server instance at: at emitErrorNT (node:net:1357:8)