4

What might be causing the error ``` /usr/local/lib/node_modules/serve/build/main.js:4 import { cwd as getPwd, exit, env as env2, 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

Viral Jain
  • 41
  • 1
  • 2

2 Answers2

2

I had same error and changing the node version on my dockerfile solved it.

FROM node:8-alpine ---> FROM node:14-alpine

Ell
  • 21
  • 1
2

if use node 10.-.- we must install serve 13.0.0

if use node 14.-.- we must install serve 14.0.0

Navid Barsalari
  • 195
  • 2
  • 5