9
这是我的目录结构:通天编译错误:无法找到模块核心-JS /库/ FN/GET-迭代
├───demo
│ ├───entry
│ │ ├───index.js
│ │ ├───tap.js
│ │ └───util.js
│ ├───node_modules
│ ├───index.html
│ ├───package.json
│ └───webpack.config.js
├───src
│ ├───tap.js
│ └───util.js
├───index.js
└───package.json
在demo/entry/index.js
我
import tap from '../../src/tap';
在编制本,巴贝尔抛出错误
ERROR in ../src/tap.js
Module build failed: Error: Cannot find module 'core-js/library/fn/get-iterator'
但它的工作原理,如果我输入这样的
import tap from './tap';
档案./tap.js
和../../src/tap
是一样的。
问题node_modules
?因为在demo
目录下,babel和其他东西都在node_modules
之内,所以我可以import
我喜欢的任何文件。但src/tap.js
没有像node_modules
这样的父级或兄弟目录,所以会触发此错误。
这发生在我身上的唯一一次,一些文件夹从node_modules/core-js/library中消失了。我不得不删除并重新安装core-js。 – Targaryen
你确定'tab.js'没有'import ... get-iterator'这个地方,它看起来对你来说是正确的,tab.js现在被导入,但是你必须处理它的导入。 – Val
这个错误有什么进展?运行反应教程时遇到同样的错误。 https://www.tutorialspoint.com/reactjs/index.htm – ibubi