我通过遵循一些视频教程来学习React.js。一切正常,但今天我继续工作,并向组件添加了状态,保存后突然出现babel-core
错误。
我是React的新手,所以我不明白这是什么错误,并且我认为这与我今天所做的组件更改无关。
到目前为止,我还已经在github here
在网页上我收到此错误消息-
Failed to compile
./node_modules/babel-core/lib/helpers/resolve.js
Module not found: Can't resolve 'module' in 'C:\Users\Sachin Verma\Desktop\WebD work\React\The Burger Builder\node_modules\babel-core\lib\helpers'
在控制台中,我得到这个长错误-
Uncaught Error: Cannot find module "module"
at webpackMissingModule (resolve.js:34)
at Object.<anonymous> (resolve.js:34)
at Object../node_modules/babel-core/lib/helpers/resolve.js (resolve.js:46)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../node_modules/babel-core/lib/helpers/resolve-from-possible-names.js (resolve-from-possible-names.js:6)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object.<anonymous> (resolve-plugin.js:6)
at Object../node_modules/babel-core/lib/helpers/resolve-plugin.js (resolve-plugin.js:21)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object.<anonymous> (option-manager.js:43)
at Object../node_modules/babel-core/lib/transformation/file/options/option-manager.js (option-manager.js:383)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object.<anonymous> (index.js:42)
at Object../node_modules/babel-core/lib/transformation/file/index.js (index.js:737)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../node_modules/babel-core/lib/api/node.js (node.js:6)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../node_modules/babel-core/index.js (index.js:1)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../src/components/Burger/Burger.js (Burger.css:26)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../src/containers/BurgerBuilder/BurgerBuilder.js (Layout.js:15)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../src/App.js (fetch.js:461)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object../src/index.js (index.css?f255:26)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at fn (bootstrap 8d64744152fbd1b327ed:88)
at Object.0 (registerServiceWorker.js:117)
at __webpack_require__ (bootstrap 8d64744152fbd1b327ed:678)
at bootstrap 8d64744152fbd1b327ed:724
at bootstrap 8d64744152fbd1b327ed:724
index.js:2178 ./node_modules/babel-core/lib/helpers/resolve.js
Module not found: Can't resolve 'module' in 'C:\Users\Sachin Verma\Desktop\WebD work\React\The Burger Builder\node_modules\babel-core\lib\helpers'
更新:
我运行npm run eject
添加一些配置,以使组件的CSS文件中的类名不会相互冲突。
我添加了这两行。
答案 0 :(得分:2)
我猜您在Udemy上接受了React的Maximilian类,并且在第8部分-第129节中遇到了此问题。这是因为当您尝试创建变量transformdIngredient时,可能会得到有关transform关键字的建议,该关键字保留了babel-core中的关键字已导入到js文件的顶部。删除它,就可以了。
答案 1 :(得分:1)
该特定错误是由您尚未安装的tmpTxt.ignore(100, '='); //skips past the =
tmpTxt.ignore(100, ' '); //skips past the space
ConfigVec.push_back(tmpTxt.get()); //reads value and pushes it back to the vector(I want this value to be 5)
库中的you having inadvertently added this import引起的:
babel-core
删除线路,您很好。
但是,我仍然想知道为什么您在仓库中完成了import { transform } from 'babel-core';
...