简体   繁体   中英

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

[Pipeline] 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

at /var/lib/jenkins/workspace/referral-sdk-js_jenkins-deploy/src/store/ConfigStore.js:2:9

[2m1: import { applyMiddleware, compose, createStore } from "redux"; 2: import { createLogger } from 'redux-logger' ^ 3: import reducers from "../redux"; 4: import thunk from "redux-thunk";[22m

Hi there and welcome,

So the error comes from line 2 for the ReactJs source code at src/store/ConfigStore.js

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.

This is the line here:

import {createLogger} from 'redux-logger';

It cannot find createLogger or it's not exported.

This seems to be an error with the package, where you will find some solutions: 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
  • Depending on what bundler you are using (eg webpack or rollup) perhaps try some of the solutions from the issue eg
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

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

  "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"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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