我使用reactstrap、bootstrap和nextjs得到了这个错误
Server Error
SyntaxError: The requested module 'react-popper' is expected to be of type CommonJS, which does not support named exports. CommonJS modules can be imported by importing the default export.
For example:
import pkg from 'react-popper';
const { Manager, Popper, Reference } = pkg;这是我的package.json文件
"@apollo/react-hooks": "^3.1.5",
"@apollo/react-ssr": "^3.1.5",
"@emotion/cache": "^11.5.0",
"@emotion/react": "^11.5.0",
"@emotion/server": "^11.4.0",
"@emotion/styled": "^11.3.0",
"@material-ui/core": "^4.12.3",
"@material-ui/icons": "^4.11.2",
"@popperjs/core": "^2.10.2",
"apollo-boost": "^0.4.7",
"apollo-link-http": "^1.5.17",
"axios": "^0.24.0",
"bootstrap": "^5.1.3",
"express": "^4.17.1",
"graphql": "^15.0.0",
"isomorphic-fetch": "^2.2.1",
"js-cookie": "^2.2.1",
"next": "^12.0.1",
"next-apollo": "^3.1.10",
"next-with-apollo": "^5.2.1",
"prop-types": "^15.7.2",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-popper": "^2.2.5",
"reactstrap": "^9.0.0"我在网上查看了一些文章,建议我安装react-popper和@popperjs/core,我安装了,但它不起作用
发布于 2021-11-13 16:33:48
我今天遇到了同样的问题。请尝试更新到最新版本的Node.js。这为我解决了这个问题。
要确认是否安装了最新版本,请在终端中键入node -v。
https://stackoverflow.com/questions/69911194
复制相似问题