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/core
will show the following result:
pnpm
For projects using pnpm, you can use the pnpm ls
command.
For example, running pnpm ls @modern-js/core --depth Infinity
will show the following result:
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.
When using Modern.js, it is recommended to use the latest version of Node.js 18.x.
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:
For 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 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
.
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.
The recommended React version for the Modern.js framework is >= 18.0.0, and different functions have different requirements for the React version.
In future major versions of Modern.js, we will gradually remove support for React 16 and React 17. Therefore, please upgrade to React 18 or higher as soon as possible.
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 can upgrade and unify the version of modern.js related packages through npx modern upgrade
command.
In the monorepo, the above error may also occur due to inconsistent versions of the Modern.js framework used by different sub-projects.