reactjs 语法错误:意外的令牌{ at Module._compile(internal/modules/cjs/loader.js:723:23)

uqdfh47h  于 2023-04-11  发布在  React
关注(0)|答案(2)|浏览(284)

什么可能导致错误``` /usr/local/lib/node_modules/serve/build/main.js:4 import { cwd as getPwd,exit,env as env 2,stdout } from“node:process”;^

/usr/local/lib/node_modules/serve/build/main.js:4
import { cwd as getPwd, exit, env as env2, stdout } from "node:process";
       ^

SyntaxError: Unexpected token {
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
root@alogistics:~/deliveryboy/cra-starter-kit# npm install -g serve
yfwxisqw

yfwxisqw1#

我也有同样的错误,在我的dockerfile上更改节点版本解决了它。
FROM节点:8-alpine ---〉FROM节点:14-alpine

qyyhg6bp

qyyhg6bp2#

如果使用节点10.-.-我们必须安装server13.0.0
如果使用节点14.-.-我们必须安装server14.0.0

相关问题