【发布时间】:2021-06-27 22:19:21
【问题描述】:
我想在 centos 服务器上部署一个 nextjs 应用程序。但是当我尝试使用 npm run build 构建时,它给了我以下错误
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db
info - Creating an optimized production build
Failed to compile.
ModuleNotFoundError: Module not found: Error: Can't resolve '../context/auth/AuthState' in '/var/www/html/projectname/pages'
> Build error occurred
Error: > Build failed because of webpack errors
at build (/var/www/html/projectname/node_modules/next/dist/build/index.js:15:918)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client-ubii-app@0.1.0 build: `next build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client-ubii-app@0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-03-31T21_10_01_066Z-debug.log
但是当我在本地机器上运行 windows 10 时,它工作正常
【问题讨论】:
-
您如何在 CentOS 机器上构建/运行应用程序?你使用 Docker 吗?
标签: npm webpack next.js centos7