我在GitLab的流水线中遇到了一个错误。我根据StackOverflow上的信息更改了.eslint.json
的设置,但仍然存在问题。
我的.eslint.json
看起来像这样:
我的.eslint.json
文件如下:
{
"extends": "eslint:recommended",
"rules": {
"semi": ["warn", "never"],
"quotes": ["warn", "single"],
"no-console": ["off"]
},
"parserOptions": {
"ecmaVersion": 9
},
"env": {
"es6": true,
"node": true,
"browser": true,
"amd": true
},
"globals": {
"$": true,
"require": true
"process": true
},
"root": true
}
在env
中,我添加了"adm": true
,并在globals
中添加了"process": true
和"require": true
。
错误如下:
错误:'require'未定义 no-undef
错误:'process'未定义 no-undef
包含错误的文件如下所示:
const qs = require("querystring");
const coEndpoint =
process.env.NODE_ENV == "production"
那么问题出在哪里?是环境节点的问题吗?我应该如何修复它呢?
"require": true
。 - MjZacprocess:true
,仍然存在错误。 - anna