【发布时间】:2021-05-31 22:28:25
【问题描述】:
在 vercel 上部署项目时遇到此问题,
文件名:comps/Navbar.js
导入为import Navbar from "./Navbar";
16:36:51 ModuleNotFoundError: Module not found: Error: Can't resolve '../comps/navbar' in '/vercel/workpath0/pages'
16:36:51 > Build error occurred
16:36:51 Error: > Build failed because of webpack errors
16:36:51 at /vercel/workpath0/node_modules/next/dist/build/index.js:15:918
16:36:51 at processTicksAndRejections (internal/process/task_queues.js:93:5)
16:36:51 at async /vercel/workpath0/node_modules/next/dist/build/tracer.js:1:525
16:36:51 npm ERR! code ELIFECYCLE
16:36:51 npm ERR! errno 1
16:36:51 npm ERR! friendlist@0.1.0 build: `next build`
16:36:51 npm ERR! Exit status 1
16:36:51 npm ERR!
16:36:51 npm ERR! Failed at the friendlist@0.1.0 build script.
16:36:51 npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
16:36:51 npm ERR! A complete log of this run can be found in:
16:36:51 npm ERR! /vercel/.npm/_logs/2021-03-02T11_06_51_966Z-debug.log
16:36:51 Error: Command "npm run build" exited with 1
16:36:56 Done with "package.json"
net ninja next js 播放列表中的代码
【问题讨论】:
-
可能是外壳问题,
navbarvsNavbar? -
哦,是的,它刚刚解决了我的问题,我正在使用“导航栏”和“导航栏”推送我的代码,但 git 并不认为这是一个更改,为此我更改了文件名GitHub 本身并已部署。谢谢@paulogdm 和 juliomalves。
标签: javascript npm deployment next.js vercel