【发布时间】:2019-07-17 18:15:10
【问题描述】:
var app= express();
const port=process.env.PORT || 4000;
app.listen(port,function(){
console.log('Listen on port '+port);
});
当我运行这个命令时
$PORT=4001 npm run test
我看到了这个错误
PORT=4001 : The term 'PORT=4001' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ PORT=4001 npm run test
+ ~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (PORT=4001:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
【问题讨论】:
-
我想你可能需要以
export PORT=4001运行
标签: javascript node.js port