简体   繁体   English

使用'npx microbundle'命令在jenkins中构建nodejs应用程序gettig错误

[英]Building nodejs app in jenkins using 'npx microbundle' command gettig error

[Pipeline] sh [管道] sh

  • npx microbundle-crl build --target web --external none --format umd --name ReferralSdk --css inline npx: installed 513 in 29.549s [31m[1mError: 'createLogger' is not exported by node_modules/redux-logger/dist/redux-logger.js, imported by src/store/ConfigStore.js[39m[22m npx microbundle-crl build --target web --external none --format umd --name ReferralSdk --css inline npx: 在 29.549 秒内安装了 513 [31m[1mError: ‘createLogger’ is not export by node_modules/redux-logger/ dist/redux-logger.js,由 src/store/ConfigStore.js[39m[22m] 导入

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:一些可能的解决方案是:

  • upgrade or downgrade the package, by going to package.json and finding the dependency react-logger and finding an appropriate version that exports this function correctly通过转到package.json并找到依赖项react-logger并找到正确导出此函数的适当版本来升级或降级包
  • Depending on what bundler you are using (eg webpack or rollup) perhaps try some of the solutions from the issue eg根据您使用的捆绑程序(例如 webpack 或 rollup),也许可以尝试一些问题的解决方案,例如
import * as logger from 'redux-logger';

logger.__moduleExports.createLogger;
  • if you are using typescript (it doesnt look like it) remember to include the @types eg npm i @types/redux-logger如果您正在使用打字稿(它看起来不像),请记住包含 @types 例如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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM