The current behavior
ERROR in ./index.jsx
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module '@babel/plugin-transform-modules-commonjs' from '/Users/smarttang/butterfly/example'
at Function.resolveSync [as sync] (/Users/smarttang/butterfly/example/node_modules/resolve/lib/sync.js:111:15)
at resolveStandardizedName (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
at resolvePlugin (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/files/plugins.js:54:10)
at loadPlugin (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/files/plugins.js:62:20)
at createDescriptor (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
at /Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/config-descriptors.js:109:50
at Array.map (<anonymous>)
at createDescriptors (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPluginDescriptors (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/config-descriptors.js:105:10)
at /Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/config-descriptors.js:63:53
ℹ 「wdm」: Failed to compile.
The expected behavior
正常运行。。。
Your environment(such as: Butterfly version、Browser version、OS and so on)
Butterfly version
:
最新刚拉的。Browser version
:
版本 101.0.4951.64(正式版本) (arm64)
OS
:
Steps To Reproduce, Maybe you can provide a simple demo.
➜ example git:(master) npm install --registry=https://registry.npm.taobao.org
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated html-webpack-plugin@3.2.0: 3.x is no longer supported
npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated core-js@1.2.7: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.4 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
added 1226 packages in 39s
➜ example git:(master) npm start
> example@1.0.0 start
> webpack-dev-server
ℹ 「wds」: Project is running at http://localhost:8080/
ℹ 「wds」: webpack output is served from /butterfly-dag
ℹ 「wds」: Content not from webpack is served from /Users/smarttang/butterfly/example
ℹ 「wds」: 404s will fallback to /index.html
✖ 「wdm」: Hash: ae8d2d9d5ddd18c0ec1e
Version: webpack 4.41.6
Time: 473ms
Built at: 2022/06/03 下午9:37:23
Asset Size Chunks Chunk Names
app.js 910 KiB app [emitted] app
Entrypoint app = app.js
[0] multi (webpack)-dev-server/client?http://localhost:8080 ./index.jsx 40 bytes {app} [built]
[./index.jsx] 1.28 KiB {app} [built] [failed] [1 error]
[./node_modules/ansi-html/index.js] 4.16 KiB {app} [built]
[./node_modules/ansi-regex/index.js] 286 bytes {app} [built]
[./node_modules/html-entities/lib/index.js] 449 bytes {app} [built]
[./node_modules/loglevel/lib/loglevel.js] 9.34 KiB {app} [built]
[./node_modules/strip-ansi/index.js] 150 bytes {app} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost:8080] (webpack)-dev-server/client?http://localhost:8080 4.29 KiB {app} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {app} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {app} [built]
[./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.91 KiB {app} [built]
[./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {app} [built]
[./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.59 KiB {app} [built]
[./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {app} [built]
[./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {app} [built]
+ 19 hidden modules
ERROR in ./index.jsx
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module '@babel/plugin-transform-modules-commonjs' from '/Users/smarttang/butterfly/example'
at Function.resolveSync [as sync] (/Users/smarttang/butterfly/example/node_modules/resolve/lib/sync.js:111:15)
at resolveStandardizedName (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
at resolvePlugin (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/files/plugins.js:54:10)
at loadPlugin (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/files/plugins.js:62:20)
at createDescriptor (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
at /Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/config-descriptors.js:109:50
at Array.map (<anonymous>)
at createDescriptors (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPluginDescriptors (/Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/config-descriptors.js:105:10)
at /Users/smarttang/butterfly/example/node_modules/@babel/core/lib/config/config-descriptors.js:63:53
ℹ 「wdm」: Failed to compile.
5条答案
按热度按时间mefy6pfw1#
好的,收到,我们看看
koaltpgm2#
看了下。是按照你这样操作是存在这个问题。
正常按照readme里的操作是不会出现这个问题
现在发现,最外层安装依赖会存在问题。
-f后依然有新的问题
最后解法:缺啥装啥
"@babel/plugin-transform-modules-commonjs": "~7.15.0",
你可以先这样处理。我们后面修复下这一系列问题。
s4n0splo3#
好像明白了啥,就是先在外面npm install,然后进exp里再npm install ?
但是不理解这个有啥问题?
ep6jt1vc4#
是这样的。
导致这个的问题是:
首先example里的依赖不全(就是缺报错里的那个),然后这个依赖在外层有。根据这个找依赖的规则,里面没有就会去外面找。
如果先装了外面的依赖,这时候里面运行时找不到这个包,去外面找就可以找到。就不会报错。
如果没装外面的依赖,这时候里面运行时找不到这个包,去外面找也找不到。就会报前面那个错误。
你可以先去了解一些寻找这个依赖的规则和原理,就明白了。
缺啥依赖装一下就可以搞定的。
明白了的话,请close一下这个issue
yftpprvb5#
收到,我一会关掉,谢谢哈。 发自我的iPhone…
在 2022年6月9日,09:37,Zt448143356 ***@***.***> 写道: 是这样的。 导致这个的问题是: 首先example里的依赖不全(就是缺报错里的那个),然后这个依赖在外层有。根据这个找依赖的规则,里面没有就会去外面找。 如果先装了外面的依赖,这时候里面运行时找不到这个包,去外面找就可以找到。就不会报错。 如果没装外面的依赖,这时候里面运行时找不到这个包,去外面找也找不到。就会报前面那个错误。 你可以先去了解一些寻找这个依赖的规则和原理,就明白了。 缺啥依赖装一下就可以搞定的。 明白了的话,请close一下这个issue — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.