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.zpnpm
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.zIf 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 22For local development environments, it is recommended to use fnm, which has better performance than nvm and has similar usage.
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.
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.
Modern.js framework requires React version >= 18.0.0.
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.