5

汇总错误示例

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

我错过了什么吗?这是一个具有最小配置的项目,可以重现我遇到的“问题”。问题似乎只是无关的命令行日志记录,而不会影响捆绑包本身;即捆绑包被正确和准确地创建。

该项目显示输出:

$ ./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

在其他项目中,我有类似的问题,额外的解决“失败”似乎不会影响捆绑包本身。这是很容易解决的问题吗?

我创建了一个 Git 存储库 - https://github.com/kalisjoshua/rollup-error-example - 它展示了这种行为。

我错过了什么?

4

1 回答 1

8

显示如何重现错误的 github 上的 repo 显示正在使用 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"
   }
于 2016-12-14T19:42:23.087 回答