我知道Jenkins,我在那里运行我的代码,在Node.js上使用旧版本,但我没有任何更新权限。不幸的是,更新Node.js对我来说不是一个选择。我已经完成了关于github,stackoverflow等的所有建议,但我的代码仍然在Jenkins构建中失败。 这是我添加到webpack.production.config.js的第一行:
require('es6-promise').polyfill();
require('es6-promise/auto');
var Promise = require('promise');
这里添加的模块到package.json:
"devDependencies": {
...
"es6-promise": "^4.0.5",
"promise" : "^7.1.1"
}
但是我仍然在jenkins构建中遇到以下错误:
14:33:20 ERROR in ./~/css-loader!./~/less-loader!./style/cwa/global.less
14:33:20 Module build failed: ReferenceError: Promise is not defined
14:33:20 at LazyResult.async (/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:225:31)
14:33:20 at LazyResult.then (/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:131:21)
14:33:20 at processCss (/node_modules/css-loader/lib/processCss.js:199:5)
14:33:20 at Object.module.exports (/node_modules/css-loader/lib/loader.js:24:2)
14:33:20 @ ./style/cwa/global.less 4:14-123
14:33:20 ERROR in ./~/css-loader!./~/less-loader!./style/cwa/autosuggest.less
14:33:20 Module build failed: ReferenceError: Promise is not defined
14:33:20 at LazyResult.async (/node_modules/postcss/lib/lazy-result.js:225:31)
14:33:20 at LazyResult.then (/node_modules/css-loader/node_modules/postcss/lib/lazy-result.js:131:21)
14:33:20 at processCss (/node_modules/css-loader/lib/processCss.js:199:5)
14:33:20 at Object.module.exports (/node_modules/css-loader/lib/loader.js:24:2)
14:33:20 @ ./style/cwa/autosuggest.less 4:14-128
我真的不知道在这个阶段该做什么。 如果有人知道,请帮助。