vue-markdown icon indicating copy to clipboard operation
vue-markdown copied to clipboard

Cannot find module 'babel-runtime/core-js/get-iterator' in Electron build

Open cawa-93 opened this issue 8 years ago • 31 comments

I use your library with electron-vue. When I run DEV mod - all is well. But after building production version I get an error

Uncaught Error: Cannot find module 'babel-runtime/core-js/get-iterator'
    at Module._resolveFilename (module.js:470:15)
    at Function.Module._resolveFilename (/home/alex/LinWin/Develop/command-editor/dist/linux-unpacked/resources/electron.asar/common/reset-search-paths.js:35:12)
    at Function.Module._load (module.js:418:25)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    at webpackUniversalModuleDefinition (/home/alex/LinWin/Develop/command-editor/dist/linux-unpacked/resources/app.asar/node_modules/vue-markdown/dist/vue-markdown.common.js:9:28)
    at /home/alex/LinWin/Develop/command-editor/dist/linux-unpacked/resources/app.asar/node_modules/vue-markdown/dist/vue-markdown.common.js:16:3
    at Object.<anonymous> (/home/alex/LinWin/Develop/command-editor/dist/linux-unpacked/resources/app.asar/node_modules/vue-markdown/dist/vue-markdown.common.js:400:2)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)

Import in component:

import VueMarkdown from 'vue-markdown'

export default {
	name: 'about',
	components: { VueMarkdown },
	 // ...
}

cawa-93 avatar Feb 20 '17 12:02 cawa-93

Delete node_modules folder, re npm install~~

miaolz123 avatar Feb 21 '17 04:02 miaolz123

@miaolz123 I am still getting this error after re-installing everything. I then did a npm install in node_modules/vue-markdown because there was no node_modules there and then got a new error:

{ [Error: ./~/vue-markdown/~/markdown-it-emoji/lib/data/full.json
Module parse failed: C:\Users\[REDACTED]\node_modules\vue-markdown\node_modules\markdown-it-emoji\lib\data\full.json Unexpected token (2:7)
You may need an appropriate loader to handle this file type.
| {
|   "100": "💯",
|   "1234": "🔢",
|   "grinning": "😀",
 @ ./~/vue-markdown/~/markdown-it-emoji/index.js 4:24-55
Windows 10

$ node -v
v6.10.0

$ npm -v
3.10.10

$ gulp -v
[07:09:41] CLI version 3.9.1
[07:09:41] Local version 3.9.1

$ npm ls webpack
C:\Users\[REDACTED]
+-- [email protected]
| +-- [email protected]
| `-- [email protected] (git://github.com/jeroennoten/webpack-stream.git#d78a3568e259f9cdbc64c60290639af6ef6d3baf)
|   `-- [email protected]
`-- [email protected]
  `-- [email protected]  extraneous

bradleybensmith avatar Mar 10 '17 12:03 bradleybensmith

@bram1028 did you resolve the issue yet?

Tin-Nguyen avatar Jul 06 '17 16:07 Tin-Nguyen

No. I had abandoned this. I just tried again and got the same error.

bradleybensmith avatar Jul 06 '17 17:07 bradleybensmith

I'm getting this same error when trying to build my Electron app. Everything works fine in dev, but it throws the error listed in production.

Any help on this?

masonfox avatar Aug 30 '17 22:08 masonfox

I just ran into this. I did npm install --save babel-runtime and the error went away, though now I'm having other difficulties.

EDIT: Just to clarify, I'm not using Electron; I'm just doing a plain old watchify build.

jrc03c avatar Sep 22 '17 14:09 jrc03c

Interesting. I'm not using Electron, I'm using babel with browserify. I ran into this error. Running npm install within the module subdirectory was enough to make to fix the problem for me.

stevage avatar Jul 18 '18 07:07 stevage

This is an issue for me using Nuxt 2.0.

These dependencies were not found:

  • babel-runtime/core-js/get-iterator in ./node_modules/vue-markdown/dist/vue-mar kdown.common.js
  • babel-runtime/core-js/object/keys in ./node_modules/vue-markdown/dist/vue-mark down.common.js

To install them, you can run: npm install --save babel-runtime/core-js/get-itera tor babel-runtime/core-js/object/keys

leopoldkristjansson avatar Sep 28 '18 15:09 leopoldkristjansson

Did you install Babel runtime: npm i babel-runtime --save

dexp-io avatar Oct 19 '18 02:10 dexp-io

Did you install Babel runtime: npm i babel-runtime --save

while. no work

kaixiniOSTT avatar Oct 21 '18 13:10 kaixiniOSTT

Same as @leopoldkristjansson , can be bypassed until real solution by adding those dependencies to the package or going to the node_modules/vue-markdown and running install there

agustingabiola avatar Oct 25 '18 15:10 agustingabiola

Just ran into this issue. Reinstalling dependencies is getting boring now...

tyteen4a03 avatar Feb 08 '19 02:02 tyteen4a03

I was still getting these problems also, so I pasted the VueMarkdown.js file from node_modules into a new file. It's only one file with a bunch of imports, so I did:

npm install --save-dev markdown-it markdown-it-emoji markdown-it-sub markdown-it-sup markdown-it-footnote markdown-it-deflist markdown-it-abbr markdown-it-ins markdown-it-mark markdown-it-toc-and-anchor markdown-it-katex markdown-it-task-lists

It worked, as in it rendered unparsed markdown, which was better than those babel runtime errors.

I'm having other issues now related to styling the markdown output. I already abandoned this library because of that but I'm having the same issue with the markdown editor example from the Vue docs, and an article that shows how to make a markdown preview component, AND with vue-tiptap.

There seems to be an issue with v-html and styling CSS that is way out of the scope of this GitHub issue.

Long story short, I think I fixed the problem described in here with my described steps, but I'm not sure so I'll just leave this comment about it.

Also I recommend caution with just blindly installing babel-runtime especially if you are using Babel 7. You might be massively inflating your bundle size. I saw mine go up 70kb at one point.

agm1984 avatar May 09 '19 20:05 agm1984

Getting this issue with vue-cli.

fjeddy avatar Jun 17 '19 13:06 fjeddy

Same here with Nuxt 2.0.0:

These dependencies were not found: friendly-errors 11:29:00 friendly-errors 11:29:00

  • babel-runtime/core-js/get-iterator in ./node_modules/vue-markdown/dist/vue-markdown.common.js friendly-errors 11:29:00
  • babel-runtime/core-js/object/keys in ./node_modules/vue-markdown/dist/vue-markdown.common.js

Imported as follow in a plugin.

import Vue from 'vue'
import VueMarkdown from 'vue-markdown'

Vue.use(VueMarkdown)

filippolcr avatar Jul 03 '19 09:07 filippolcr

Same here in a Laravel Mix / Vue project.

MichMich avatar Oct 23 '19 11:10 MichMich

#92 proposes a fork where this issue is fixed.

dargmuesli avatar Nov 28 '19 18:11 dargmuesli

Babel 7 has switched to scoped packages, so the rumtime is avaialble under "@babel/rumtime", instead of 'babel-runtime' as in Babel v6. I think the developer would need to update the dependency. https://babeljs.io/docs/en/next/v7-migration#scoped-packages

In the mean time, explicitly installing babel v6 fixes it for me.

npm install --save babel-runtime

ZeanQin avatar Nov 29 '19 01:11 ZeanQin

I am using yarn, this worked for me

yarn add babel-runtime --save

fguillen avatar Dec 15 '19 19:12 fguillen

it's works for me too. my env is nuxt ^2.0.0.

npm i babel-runtime --save

che5ya avatar Dec 18 '19 08:12 che5ya

Also ran into this problem, followed the README instructions in a blank vue-cli project.

coolsoftwaretyler avatar Jan 10 '20 20:01 coolsoftwaretyler

I experienced this issue today on our build server, things had been working fine for a few weeks and out of the blue this error started appearing. npm i babel-runtime --save fixed things but not sure why this wasn't needed originally.

bsansone avatar Feb 28 '20 20:02 bsansone

Hi, had this issue today on a fresh install. Here is what I ran:

yarn add babel-runtime --save

It then compiled and worked.

clouedoc avatar Mar 07 '20 20:03 clouedoc

Same here in a Nuxt 2.13+ project.

npm i babel-runtime fix it

ballonura avatar Jun 28 '20 12:06 ballonura

Got similar issue as well and yarn add babel-runtime does the magic!

I spent quite some time to find the problem, and I just want to put it here so if people search they can find this too:

I deployed a Nuxt app with vue-markdown on Google App Engine and got error randomly in some pages that use vue-markdown:

ERROR render function or template not defined in component: anonymous
at Qi (node_modules/vue-server-renderer/build.prod.js:1:66749)
at io (node_modules/vue-server-renderer/build.prod.js:1:70622)
at ro (node_modules/vue-server-renderer/build.prod.js:1:70272)
at eo (node_modules/vue-server-renderer/build.prod.js:1:67519)
at node_modules/vue-server-renderer/build.prod.js:1:70739

When setting NODE_ENV to "development", it throws similar error of this post.

ERROR Cannot find module 'babel-runtime/core-js/get-iterator'

Note: The error does not shown in local development (nuxt build and then nuxt start).

The solution is as stated by many above. babel-runtime fixes the problem!

pixelart7 avatar Jul 31 '20 04:07 pixelart7

use npm i babel-runtime --save to resolve this error, it worked

macOS 10.14 [email protected] [email protected] [email protected]

slc3a2 avatar Sep 08 '20 09:09 slc3a2

As mentioned above, simply installing babel-runtime may screw some things up because that is babel@6. If you are using a build tool like webpack with babel@7 simply use

import Vue from "vue";
import { install as VueMarkdown } from "vue-markdown/src/build";

Vue.use(VueMarkdown);

in your start-up file, or

<template>
    ...
</template>

<script>
import VueMarkdown from "vue-markdown/src/VueMarkdown";

export default {
    ...,
    components: {
        VueMarkdown,
        ...
    },
    ...
};
</script>

in the single-file component.

If you happen to use this import a lot and don't want to install the plugin globally, you can also add an alias to the webpack config.

schl3ck avatar Sep 10 '20 13:09 schl3ck

I had this problem today. I went directly into node_modules/vue-markdown and ran npm install there, and it resolved the issue but with a ton of warnings, including

core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

so I upgraded core-js in that folder, and got the error again.

It looks like get-iterator is no longer part of core-js or that functionality has been renamed. I'll try the solution mentioned @schl3ck next.

That worked like a charm.

mcasto avatar Sep 28 '20 15:09 mcasto

This is still an issue. Recently installed Nuxt.js version 2.14.6, and then installed vue-markdown to render markdown content for a website. Had to run yarn add babel-runtime to make this issue disappear.

OssiPesonen avatar Dec 10 '20 19:12 OssiPesonen

Did you install Babel runtime: npm i babel-runtime --save

thanks work for me, on Gridsome and Strapi

Lowell130 avatar Dec 27 '20 11:12 Lowell130

still an issue.

quiquelhappy avatar Jan 31 '22 12:01 quiquelhappy