简体   繁体   English

在 React 18 上安装包时遇到问题

[英]Having a problem with installing a package on React 18

I tried to install react-neshan-map-leaflet and everything was installed well without errors,我尝试安装react-neshan-map-leaflet并且一切都安装得很好,没有错误,

After the project started, I saw this error:项目启动后,我看到了这个错误:

ERROR in ./node_modules/react-neshan-map-leaflet/dist/NeshanMap.js 2:0-60
Module not found: Error: Can't resolve './loaders/neshan_map_loader' in 'C:\Users\Desktop\time-line\node_modules\react-neshan-map-leaflet\dist'
Did you mean 'neshan_map_loader.js'?
BREAKING CHANGE: The request './loaders/neshan_map_loader' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

最后我找到了方法,也许它也对你有用:我使用了 react 18,首先我将版本更改为 17.0.2,然后我使用了较低版本的包,一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM