• 카테고리

    질문 & 답변
  • 세부 분야

    풀스택

  • 해결 여부

    미해결

ubuntu front 빌드 에러

23.12.01 19:41 작성 조회수 595

0

ubuntu@ip-172-31-45-72:~/TwitterClone-FS-/front$ npm install
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@faker-js/faker@8.3.1',
npm WARN EBADENGINE   required: { node: '^14.17.0 || ^16.13.0 || >=18.0.0', npm: '>=6.14.13' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'next@13.5.6',
npm WARN EBADENGINE   required: { node: '>=16.14.0' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'styled-components@6.1.1',
npm WARN EBADENGINE   required: { node: '>= 16' },
npm WARN EBADENGINE   current: { node: 'v12.22.9', npm: '8.5.1' }
npm WARN EBADENGINE }

up to date, audited 421 packages in 3s

105 packages are looking for funding
  run `npm fund` for details

1 high severity vulnerability

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.
ubuntu@ip-172-31-45-72:~/TwitterClone-FS-/front$ npm run dev

> react-nodebird-front@1.0.0 dev
> next

/home/ubuntu/TwitterClone-FS-/front/node_modules/next/dist/lib/picocolors.js:134
const { env, stdout } = ((_globalThis = globalThis) == null ? void 0 : _globalThis.process) ?? {};
                                                                                             ^

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:915:16)
    at Module._compile (internal/modules/cjs/loader.js:963:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at Module.mod.require (/home/ubuntu/TwitterClone-FS-/front/node_modules/next/dist/server/require-hook.js:64:28)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/ubuntu/TwitterClone-FS-/front/node_modules/next/dist/build/output/log.js:55:21)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
ubuntu@ip-172-31-45-72:~/TwitterClone-FS-/front$ ls
components  next.config.js  package-lock.json  pages     sagas  utils
hooks       node_modules    package.json       reducers  store
ubuntu@ip-172-31-45-72:~/TwitterClone-FS-/front$ 

이런 에러가 발생됩니다. unexpected token '?' 어떤 이유로 에러가 발생하고, 어떤식으로 해결해야지 실행할 수 있는지 알 고 싶습니다!!

답변 1

답변을 작성해보세요.

0

노드 버전이 너무 낮습니다. 노드 버전을 18버전 이상으로 올리세요

김용민님의 프로필

김용민

질문자

2023.12.01

ubuntu@ip-172-31-45-72:~/TwitterClone-FS-/front$ npm build
node:internal/modules/cjs/loader:1144
  const err = new Error(message);
              ^

Error: Cannot find module 'semver'
Require stack:
- /usr/share/nodejs/npm/lib/utils/unsupported.js
- /usr/share/nodejs/npm/lib/cli.js
- /usr/share/nodejs/npm/bin/npm-cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1144:15)
    at Module._load (node:internal/modules/cjs/loader:985:27)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (/usr/share/nodejs/npm/lib/utils/unsupported.js:2:16)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/share/nodejs/npm/lib/utils/unsupported.js',
    '/usr/share/nodejs/npm/lib/cli.js',
    '/usr/share/nodejs/npm/bin/npm-cli.js'
  ]
}

Node.js v20.10.0
ubuntu@ip-172-31-45-72:~/TwitterClone-FS-/front$ 

버전 올린 후, semver 에러가 발생했는데 이 부분이 계속 해결되지 않습니다..!! 혹시 어떻게해야할지 알려주실 수 있을까요?

npm i 다시 하세요. node_modules 지운 후에요.