我使用Nextjs框架创建了一个项目。
当我使用npm run dev
命令运行项目时,我的项目可以正常运行,一切都很好。
但是,当我运行npm run build
命令来构建项目时,之后我找不到构建文件夹。
下面是完整的报告,这是构建器向我展示的:
λ npm run builddastshafa-final@0.1.0 build next build
info - 检查类型的有效性
./pages/cartProcess/index.js 13:6 警告:React Hook useEffect缺少依赖项:“displayNavbar”。要么包含它,要么删除依赖项数组。如果“displayNavbar”变化太频繁,请找到定义它的父组件,并在useCallback中包装该定义。react-hooks/exhaustive-deps 31:11 警告:不要使用。改用来自“next/image”的Image。请参见:https://nextjs.org/docs/messages/no-img-elem ent @next/next/no-img-element
./pages/index.js 14:6 警告:React Hook useEffect缺少依赖项:“setDisplayNavbar”。要么包含它,要么删除依赖项数组。如果“setDisplayNavbar”变化太频繁,请找到定义它的父组件,并在useCallback中包装该定义。react-hooks/exhaustive-deps
./components/navbar.js 58:21 警告:不要使用。改用来自“next/image”的Image。请参见:https://nextjs.org/docs/messages/no-img-elem ent @next/next/no-img-element 101:17 警告:缺少passHref。请参见:https://nextjs.org/docs/messages/link-passhref @next/next/link-passhref 117:9 警告:缺少passHref。请参见:https://nextjs.org/docs/messages/link-passhref @next/next/link-passhref 118:11 警告:不要使用。改用来自“next/image”的Image。请参见:https://nextjs.org/docs/messages/no-img-ele ment @next/next/no-img-element 118:11 警告:img元素必须具有alt属性,其中包含有意义的文本或用于装饰图像的空字符串。jsx-a11y/alt-text
./components/productDetail.js 72:6 警告:React Hook useMemo缺少依赖项:“productDetail”。要么包含它,要么删除依赖项数组。react-hooks/exhaustive-deps 106:15 警告:不要使用。改用来自“next/image”的Image。请参见:https://nextjs.org/docs/messages/no-img-ele ment @next/next/no-img-element 106:15 警告:img元素必须具有alt属性,其中包含有意义的文本或用于装饰图像的空字符串。jsx-a11y/alt-text
./components/productItem.js 18:7 警告:不要使用。改用来自“next/image”的Image。请参见:https://nextjs.org/docs/messages/no-img-eleme nt @next/next/no-img-element
./components/products.js 21:6 警告:React Hook useEffect缺少依赖项:“dispatch”。要么包含它,要么删除依赖项数组。react-hooks/exhaustive-deps
./components/sort.js 37:6 警告:React Hook useEffect缺少依赖项:“dispatch”。要么包含它,要么删除依赖项数组。react-hooks/exhaustive-deps 41:6 警告:React Hook useEffect缺少依赖项:“filterProducts”。要么包含它,要么删除依赖项数组。如果“filterProducts”变化太频繁,请找到定义它的父组件,并在useCallback中包装该定义。react-hooks/exhaustive-deps
info - 需要禁用某些ESLint规则吗?在这里了解更多信息:https://nextjs.org/docs/basic-features/eslint#disabling-rule s info - 创建优化的生产构建信息 - 成功编译信息 - 收集页面数据信息 - 生成静态页面(4/4)信息 - 完成页面优化
页面 大小 第一次加载JS
问题出在哪里?我该如何修复它?
package.json
文件来运行“start”,需要node_modules
目录以进行运行时依赖项(不建议上传本地版本;应该有一种方法在上传package.json
后在远程Plesk服务器上运行“npm install”),以及整个.next
目录。我会查看Plesk文档,看看他们是否有关于如何部署Node.js应用程序的特定说明。 - Mark G