RollupJS `error: Error: cannot find module 'babel-runtime``

Cumulative-Error Example

Illustrate a (possible) problem with a drive.

Am I missing something? Here is a minimal configuration project, reproduce the “problem” I am facing. The problem seems to be only an extraneous entry on the command line, without affecting the package itself; those. The bundle is created correctly and accurately.

This project displays the output:

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

The command to play it:

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

In other projects, I have similar problems with additional “failures”, the solutions do not seem to affect the kit itself. Is this something that is easy to fix?

I created a Git repository https://github.com/kalisjoshua/rollup-error-example - which demonstrates this behavior.

What am I missing?

+5
source share
1 answer

The github repo, which shows how to reproduce the error, shows version 1.2.0 of the babel-preset-es2015-rollup used. I found the following on github:

It seems that the babel-preset-es2015-rollup package just needs to be updated to the last, since after I tried this, the error no longer occurred.

 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" } 
+8
source

Source: https://habr.com/ru/post/1261277/


All Articles