我得到这个错误,我不确定首先为什么它出现,其次如何解决。错误信息:
Compiled with problems:X
ERROR in ./node_modules/axios/lib/adapters/xhr.js 17:10-24
Module not found: Error: Can't resolve 'url' in '/Users/tobiasbedford/Documents/sei/lexicon/lexicon-coding-challenge/node_modules/axios/lib/adapters'
BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.
If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "url": require.resolve("url/") }'
- install 'url'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "url": false }
当跟随路径到…Axios/lib/adapters有三个文件:
- http.js
- README.md
- xhr.js
我想知道我是否需要更改适配器文件夹中列表项#1和/或#3中的代码。尤其是在哪里。或者是否有一个安装可以快速修复。如有任何建议,我将不胜感激,如果您想查看列表项目#1或#3中的代码,请告诉我。
Axios 0.27存在此问题。根据线程,一个修复即将到来。对我来说,将Axios降级到0.26行得通
npm i axio@0.26