logo
  • Guide
  • Config
  • Plugin
  • API
  • Examples
  • Community
  • Modern.js 2.x Docs
  • English
    • 简体中文
    • English
    • Start
      Introduction
      Quick Start
      Upgrading
      Glossary
      Tech Stack
      Core Concept
      Page Entry
      Build Engine
      Web Server
      Basic Features
      Routes
      Routing
      Config Routes
      Data Solution
      Data Fetching
      Data Writing
      Data Caching
      Rendering
      Server-Side Rendering
      Streaming SSR
      Rendering Cache
      Static Site Generation
      Render Preprocessing
      Styling
      Styling
      Use CSS Modules
      Using CSS-in-JS
      Using Tailwind CSS
      HTML Template
      Import Static Assets
      Import JSON Files
      Import SVG Assets
      Import Wasm Assets
      Debug
      Data Mocking
      Network Proxy
      Using Rsdoctor
      Using Storybook
      Testing
      Playwright
      Vitest
      Jest
      Cypress
      Path Alias
      Environment Variables
      Output Files
      Deploy Application
      Advanced Features
      Using Rspack
      Using BFF
      Basic Usage
      Runtime Framework
      Extend BFF Server
      Extend Request SDK
      File Upload
      Cross-Project Invocation
      Optimize Page Performance
      Code Splitting
      Inline Static Assets
      Bundle Size Optimization
      React Compiler
      Improve Build Performance
      Browser Compatibility
      Low-Level Tools
      Source Code Build Mode
      Server Monitor
      Monitors
      Logs Events
      Metrics Events
      Internationalization
      Basic Concepts
      Quick Start
      Configuration
      Locale Detection
      Resource Loading
      Routing Integration
      API Reference
      Advanced Usage
      Best Practices
      Custom Web Server
      Topic Detail
      Module Federation
      Introduction
      Getting Started
      Application-Level Modules
      Server-Side Rendering
      Deployment
      Integrating Internationalization
      FAQ
      Dependencies FAQ
      CLI FAQ
      Build FAQ
      HMR FAQ
      📝 Edit this page
      Previous pageIntegrating InternationalizationNext pageCLI FAQ

      #Dependencies FAQ

      #How to check the actual installed version of a dependency in the project?

      You can use the ls command provided by the package manager to view the version of the dependency in the project.

      Here are some basic examples. For detailed usage, please refer to the documentation of each package manager.

      npm / yarn

      For projects using npm or yarn, you can use the npm ls command.

      For example, running npm ls @modern-js/plugin will show the following result:

      project
      └─┬ @modern-js/app-tools@x.y.z
        └── @modern-js/plugin@x.y.z

      pnpm

      For projects using pnpm, you can use the pnpm ls command.

      For example, running pnpm ls @modern-js/plugin --depth Infinity will show the following result:

      devDependencies:
      @modern-js/app-tools x.y.z
      └── @modern-js/plugin x.y.z

      #Getting "The engine "node" is incompatible" error during dependency installation?

      If you encounter the following error message during dependency installation, it means that the current environment is using a Node.js version that is too low, and you need to upgrade Node.js to a higher version.

      The engine "node" is incompatible with this module.
      
      Expected version ">=20.19.5". Got "16.20.1"

      Modern.js requires Node.js version >= 20.19.5. We strongly recommend using the latest LTS version (such as Node.js 22 LTS) for the best experience.

      If the Node.js version of the current environment is lower than the above requirement, you can use tools such as nvm or fnm to switch versions.

      Here is an example of using nvm:

      # Install Node.js 22 LTS
      nvm install 22 --lts
      
      # Switch to Node.js 22
      nvm use 22
      
      # Set Node.js 22 as the default version
      nvm alias default 22

      For local development environments, it is recommended to use fnm, which has better performance than nvm and has similar usage.


      #Getting a ReactNode type error after upgrading dependencies?

      After upgrading the dependencies of the project, if the following type error occurs, it means that the wrong version of @types/react is installed in the project.

      The types returned by 'render()' are incompatible between these types.
      Type 'React.ReactNode' is not assignable to type 'import("/node_modules/@types/react/index").ReactNode'.
      Type '{}' is not assignable to type 'ReactNode'.

      The reason for this problem is that the ReactNode type definition in React 18+ is different from that in React 16/17. If there are multiple different versions of @types/react in the project, a ReactNode type conflict will occur, resulting in the above error.

      The solution is to lock the @types/react and @types/react-dom in the project to a unified version, such as v17.

      {
        "@types/react": "^19",
        "@types/react-dom": "^19"
      }

      For methods of locking dependency versions, please refer to Lock nested dependency.


      #Getting peer dependencies warnings in the console after running pnpm install?

      The reason for this warning is that the version range of peer dependencies declared by some third-party npm packages is inconsistent with the version range installed in Modern.js.

      In most cases, peer dependencies warnings will not affect the project operation and do not need to be processed separately. Please ignore the relevant warnings.


      #What is the minimum supported version of React for the Modern.js framework?

      Modern.js framework requires React version >= 18.0.0.

      • If you are using Modern.js runtime capabilities (including SSR, Streaming SSR, data loading, routing, etc.), you must use React 18 or higher. React 16 and React 17 are no longer supported.
      • If you are only using Modern.js build capabilities (without runtime), React 16 or React 17 may theoretically work, but it is strongly recommended to upgrade to React 18 or higher for the best experience and full feature support.

      #Type error in Modern.js configuration file?

      Type 'CliPlugin<{}, {}, {}, {}>' is not assignable to type 'CliPlugin<any, {}, {}, {}>'.
        Types of property 'setup' are incompatible.

      When you use the Modern.js framework, the above error occurs in the configuration file, it may be due to the inconsistent versions of Modern.js related packages. You need to manually update all @modern-js/** packages to the same version.

      In the monorepo, the above error may also occur due to inconsistent versions of the Modern.js framework used by different sub-projects.

      For information on how to unify and upgrade dependency versions, please refer to the Upgrading documentation.