简体   繁体   English

为什么 process.env.PORT ⎮⎮ 8001 不起作用?

[英]Why is process.env.PORT ⎮⎮ 8001 not working?

I am coding the backend of a website with MERN .我正在使用MERN对网站的后端进行编码。

This is my code in server.js :这是我在server.js代码:

import express from "express"
import mongoose from "mongoose"

//App config
const app = express();
const port = process.env.PORT ⎮⎮ 8001

I get a big fat Error after typing npm start :输入npm start后我得到一个很大的错误

file:///Users/.../.../.../.../server.js:6
const port = process.env.PORT ⎮⎮ 8001               

SyntaxError: Invalid or unexpected token

If anyone knows how to solve this problem, thank you soooo much.如果有人知道如何解决这个问题,非常感谢。

Thanks in advance,提前致谢,

Emiel埃米尔

It seems like a copy-paste error.这似乎是一个复制粘贴错误。 What you have is “⎮” U+23AE Integral Extension Unicode Character :您拥有的是“⎮”U+23AE 积分扩展 Unicode 字符

What is needed is this:需要的是这样的:

|

Here's the URL Encoded form:这是 URL 编码形式:

编码URI

encodeURI("⎮")
"%E2%8E%AE"
encodeURI("|")
"%7C"

Try replacing it with the following:尝试将其替换为以下内容:

const port = process.env.PORT || 8001

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM