[英]Building nodejs app in jenkins using 'npx microbundle' command gettig error
[Pipeline] sh [管道] sh
at /var/lib/jenkins/workspace/referral-sdk-js_jenkins-deploy/src/store/ConfigStore.js:2:9在 /var/lib/jenkins/workspace/referral-sdk-js_jenkins-deploy/src/store/ConfigStore.js:2:9
[2m1: import { applyMiddleware, compose, createStore } from "redux"; [2m1: import { applyMiddleware, compose, createStore } from "redux"; 2: import { createLogger } from 'redux-logger' ^ 3: import reducers from "../redux";
2: import { createLogger } from 'redux-logger' ^ 3: import reducers from "../redux"; 4: import thunk from "redux-thunk";[22m
4:从“redux-thunk”导入thunk;[22m
Hi there and welcome,你好,欢迎,
So the error comes from line 2 for the ReactJs source code at src/store/ConfigStore.js
所以错误来自
src/store/ConfigStore.js
ReactJs 源代码的第 2 行
The error is coming from an import statement where you are trying to import createLogger
from the redux-logger
package, and it can't find that function.错误来自导入语句,您尝试从
redux-logger
包导入createLogger
,但找不到该函数。
This is the line here:这是这里的行:
import {createLogger} from 'redux-logger';
It cannot find createLogger or it's not exported.它找不到 createLogger 或未导出。
This seems to be an error with the package, where you will find some solutions: https://github.com/LogRocket/redux-logger/issues/233这似乎是包的错误,您会在其中找到一些解决方案: https : //github.com/LogRocket/redux-logger/issues/233
Some possible solutions will be to:一些可能的解决方案是:
package.json
and finding the dependency react-logger
and finding an appropriate version that exports this function correctlypackage.json
并找到依赖项react-logger
并找到正确导出此函数的适当版本来升级或降级包import * as logger from 'redux-logger';
logger.__moduleExports.createLogger;
npm i @types/redux-logger
npm i @types/redux-logger
But I already have this in my code, still i am getting error with exporting但是我的代码中已经有了这个,但我仍然在导出时出错
import { applyMiddleware, compose, createStore } from "redux";
import { createLogger } from 'redux-logger'
import reducers from "../redux";
import thunk from "redux-thunk";
const middleware = [createLogger(),thunk]
const ConfigStore = () => {
let store = null;
store = createStore(reducers,{},compose(applyMiddleware(...middleware)))
return store
}
export default ConfigStore()
Here is my package.json这是我的 package.json
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"axios": "^0.19.2",
"infinite-react-carousel": "^1.2.11",
"nuka-carousel": "^4.6.6",
"react": "^16.13.0 ",
"react-dom": "^16.13.0",
"react-items-carousel": "^2.8.0",
"react-meta-tags": "^0.7.4",
"react-redux": "^7.2.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0",
"redux": "^4.0.5",
"redux-logger": "^3.0.6",
"redux-persist": "^6.0.0",
"redux-thunk": "^2.3.0",
"rollup-plugin-commonjs": "^10.1.0"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.