Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve [ERROR] TypeError: dep.getModuleEvaluationSideEffectsState is not a function?

I have created a docusaurus project. It was working fine. I added material ui search bar in the landing page. I am using github actions to deploy the project(CI/CD). Now when i push the code, iam getting this error.

[ERROR] TypeError: dep.getModuleEvaluationSideEffectsState is not a function
    at NormalModule.getSideEffectsConnectionState (/github/workspace/website/node_modules/webpack/lib/NormalModule.js:1126:23)
    at /github/workspace/website/node_modules/webpack/lib/optimize/SideEffectsFlagPlugin.js:244:19
    at Hook.eval [as call] (eval at create (/github/workspace/website/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:12:16)
    at Hook.CALL_DELEGATE [as _call] (/github/workspace/website/node_modules/tapable/lib/Hook.js:14:14)
    at Compilation.seal (/github/workspace/website/node_modules/webpack/lib/Compilation.js:2804:42)
    at /github/workspace/website/node_modules/webpack/lib/Compiler.js:1187:20
    at /github/workspace/website/node_modules/webpack/lib/Compilation.js:2757:4
    at _next2 (eval at create (/github/workspace/website/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:35:1)
    at eval (eval at create (/github/workspace/website/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:71:1)
    at /github/workspace/website/node_modules/webpack/lib/FlagDependencyExportsPlugin.js:385:11

I am not sure how to solve this. I have also attached package.json file.

{
  "scripts": {
    "examples": "docusaurus-examples",
    "start": "docusaurus start",
    "build": "docusaurus build",
    "serve": "docusaurus serve",
    "publish-gh-pages": "docusaurus-publish",
    "write-translations": "docusaurus-write-translations",
    "version": "docusaurus-version",
    "rename-version": "docusaurus-rename-version",
    "swizzle": "docusaurus swizzle",
    "deploy": "docusaurus deploy",
    "docusaurus": "docusaurus"
  },
  "engines": {
    "node": ">=16.14.0"
  },
  "dependencies": {
    "@azure/msal-browser": "^2.28.0",
    "@azure/msal-react": "^1.4.4",
    "@docusaurus/core": "^2.0.0-rc.1",
    "@docusaurus/plugin-client-redirects": "^2.1.0",
    "@docusaurus/plugin-content-docs": "^2.0.0-rc.1",
    "@docusaurus/preset-classic": "^2.0.0-rc.1",
    "@emotion/react": "^11.10.4",
    "@emotion/styled": "^11.10.4",
    "@fortawesome/react-fontawesome": "^0.1.18",
    "@material-ui/core": "^4.12.4",
    "@mui/material": "^5.10.8",
    "axios": "^0.27.2",
    "bootstrap": "^5.1.3",
    "chart.js": "^3.8.0",
    "clsx": "^1.1.1",
    "docker": "^1.0.0",
    "docusaurus": "^1.14.7",
    "docusaurus-lunr-search": "^2.1.15",
    "docusaurus-pdf": "^1.2.0",
    "docusaurus2-dotenv": "^1.4.0",
    "env-cmd": "^10.1.0",
    "jquery": "^3.6.0",
    "moment": "^2.29.4",
    "react": "^17.0.2",
    "react-bootstrap": "^2.4.0",
    "react-chartjs-2": "^4.3.1",
    "react-dom": "^17.0.2",
    "react-icons": "^4.4.0",
    "react-markdown-editor-lite": "^1.3.2",
    "react-paginate": "^8.1.3",
    "react-player": "^2.10.1",
    "react-scripts": "^5.0.1"
  }
}

Can someone help me with this?


1 Answers

Are you using the plugin docusaurus2-dotenv?

We found the same problem here, and the root cause is this plugin. We remove this plugin from the package.json and from the docusaurus.config.js. We replaced it inside the docusaurus.config.js with the plugin docusaurus-plugin-dotenv, like this:

// Before
plugins: 
[
    // Other plugins
    ['docusaurus2-dotenv', { systemvars: true }],
]
// After
plugins: 
[
    // Other plugins
    [
      'docusaurus-plugin-dotenv',
      {
          path: "./.env", 
          systemvars: true, 
      }
    ]
]

This error occurs because the plugin 'docusaurus2-dotenv' is depreciated, although the docusaurus documentation itself recommends using it.

After removing it from our project, we noticed that even some vulnerabilities have gone away.

Here's the link of the new plugin: docusaurus-plugin-dotenv

like image 187
Stéphani Pinheiro Ferreira Avatar answered Sep 04 '25 20:09

Stéphani Pinheiro Ferreira



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!