我想在服务器上部署我的Next.js
文件。当我点击命令npm run build
时,它显示错误
需要禁用一些ESLint规则?在此处了解更多信息:https://nextjs.org/docs/basic-features/eslint#disabling-rules
我无法找到错误,因为应用程序在localhost中正常工作,但当我想进行构建时,它显示错误。我的package.json
文件中的包是
{
"name": "yourguide-next-frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "node server.js",
"build": "next build",
"start": "NODE_ENV=production node server.js"
},
"dependencies": {
"@emotion/react": "^11.10.0",
"@emotion/server": "^11.10.0",
"@emotion/styled": "^11.9.3",
"@mui/material": "^5.10.2",
"@tinymce/tinymce-react": "^4.2.0",
"cjs": "^0.0.11",
"cookies": "^0.8.0",
"js-cookie": "^3.0.1",
"next": "12.2.3",
"react": "18.2.0",
"react-bootstrap": "^2.4.0",
"react-dom": "18.2.0",
"tinymce": "^6.1.2"
},
"devDependencies": {
"@next/eslint-plugin-next": "^12.2.5",
"eslint": "8.20.0",
"eslint-config-next": "12.2.3"
}
}
我不知道ESLint rules
,请给予我这个问题的解决方案。
3条答案
按热度按时间e0uiprwp1#
要在nextjs中构建时忽略eslint,您必须将这一行添加到next.config.js文件中:
70gysomp2#
最好能分享你在构建时得到的确切错误。
要禁用eslint的某些规则,您需要做的就是编辑您的.eslintrc.json文件,使其看起来像下面这样,或者您可以添加像https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-abusive-eslint-disable.md这样的注解
bis0qfac3#
我也得到了同样的错误,我通过从我的
package.json
中删除eslint依赖来修复它