Intereting Posts

RollupJS`解决失败:错误:无法find模块'babel-runtime'`

汇总-误差示例

说明汇总的(可能的)问题。

我错过了什么吗? 这里有一个最小configuration的项目来重现我遇到的“问题”。 问题似乎只是无关的命令行日志logging,而不影响捆绑本身; 即捆绑被正确和准确地创build。

该项目显示输出:

$ ./node_modules/.bin/rollup -c rollup.js node_modules/nan resolve failed: { Error: Cannot find module 'babel-runtime' at Function.Module._resolveFilename (module.js:472:15) at Function.requireRelative.resolve (/Users/jkalis/Pro/QL/WebCore/luxui/rollup-testing/node_modules/require-relative/index.js:30:17) at resolve (/Users/jkalis/Pro/QL/WebCore/luxui/rollup-testing/node_modules/modify-babel-preset/lib/serialize.js:25:26) at findAndRemove (/Users/jkalis/Pro/QL/WebCore/luxui/rollup-testing/node_modules/modify-babel-preset/lib/serialize.js:67:11) at /Users/jkalis/Pro/QL/WebCore/luxui/rollup-testing/node_modules/modify-babel-preset/lib/serialize.js:111:13 at Array.map (native) at loadPreset (/Users/jkalis/Pro/QL/WebCore/luxui/rollup-testing/node_modules/modify-babel-preset/lib/serialize.js:103:29) at module.exports (/Users/jkalis/Pro/QL/WebCore/luxui/rollup-testing/node_modules/modify-babel-preset/index.js:97:19) at Object.<anonymous> (/Users/jkalis/Pro/QL/WebCore/luxui/rollup-testing/node_modules/babel-preset-es2015-rollup/index.js:3:18) at Module._compile (module.js:573:32) code: 'MODULE_NOT_FOUND' } babel-runtime 

重现这个命令是:

  • npm run bundle ,或
  • ./node_modules/.bin/rollup -c rollup.js

在其他项目中,我还遇到类似的问题,这些问题似乎并不影响软件包本身。 这是容易解决的东西吗?

我创build了一个Git仓库 – https://github.com/kalisjoshua/rollup-error-example – 它展现了这种行为。

我错过了什么?

Solutions Collecting From Web of "RollupJS`解决失败:错误:无法find模块'babel-runtime'`"

github上显示如何重现错误的回购显示使用的是babel-preset-es2015-rollup的版本1.2.0。 我在github上发现了以下内容:

它看起来像babel-preset-es2015-rollup软件包只是需要更新到最新,因为我尝试后,错误不再发生。

 diff --git a/package.json b/package.json index b1f4325..d5251fd 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,7 @@ "license": "MIT", "dependencies": { "babel-cli": "^6.18.0", - "babel-preset-es2015-rollup": "^1.2.0", + "babel-preset-es2015-rollup": "^3.0.0", "rollup": "^0.36.4", "rollup-plugin-babel": "^2.6.1" }