在Django上运行React时,npm无法解析babel_loader

时间:2019-09-18 19:17:25

标签: django reactjs npm webpack

我正在关注this tutorial以便将React与Django集成在一起。我已经完成所有步骤,但是当我运行npm run dev时,出现此错误:

> AttractoraProject@1.0.0 dev /Users/hugovillalobos/Documents/Code/AttractoraProject
> webpack --mode development ./Attractora/frontend/src/index.js --output ./Attractora/frontend/static/frontend/main.js


Insufficient number of arguments or no entry found.
Alternatively, run 'webpack(-cli) --help' for usage info.

Hash: cf46d3c1f598793a6a6e
Version: webpack 4.40.2
Time: 111ms

Built at: 09/18/2019 2:05:08 PM

ERROR in Entry module not found: Error: Can't resolve 'babel_loader' in '/Users/hugovillalobos/Documents/Code/AttractoraPro
ject'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! AttractoraProject@1.0.0 dev: `webpack --mode development ./Attractora/frontend/src/index.js --output ./Attractora/
frontend/static/frontend/main.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the AttractoraProject@1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/hugovillalobos/.npm/_logs/2019-09-18T19_05_08_809Z-debug.log

我运行了此命令来安装babel,所以我不知道自己缺少什么:

npm i @babel/core babel-loader @babel/preset-env @babel/preset-react babel-plugin-transform-class-properties --save-dev

0 个答案:

没有答案