miaolz123 / vue-markdown

A Powerful and Highspeed Markdown Parser for Vue
https://miaolz123.github.io/vue-markdown/
MIT License
1.92k stars 258 forks source link

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

Open cawa-93 opened 7 years ago

cawa-93 commented 7 years ago

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 },
     // ...
}
miaolz123 commented 7 years ago

Delete node_modules folder, re npm install~~

bradleybensmith commented 7 years ago

@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]
+-- laravel-elixir-webpack-official@1.0.10
| +-- webpack@2.1.0-beta.22
| `-- webpack-stream@3.2.0 (git://github.com/jeroennoten/webpack-stream.git#d78a3568e259f9cdbc64c60290639af6ef6d3baf)
|   `-- webpack@1.14.0
`-- vue-markdown@2.1.3
  `-- webpack@1.14.0  extraneous
Tin-Nguyen commented 7 years ago

@bram1028 did you resolve the issue yet?

bradleybensmith commented 7 years ago

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

masonfox commented 7 years ago

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?

jrc03c commented 7 years ago

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.

stevage commented 6 years ago

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.

leopoldkristjansson commented 6 years ago

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

dexp-io commented 6 years ago

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

kaixiniOSTT commented 6 years ago

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

while. no work

agustingabiola commented 6 years ago

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

tyteen4a03 commented 5 years ago

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

agm1984 commented 5 years ago

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.

fjeddy commented 5 years ago

Getting this issue with vue-cli.

filippolcr commented 5 years ago

Same here with Nuxt 2.0.0:

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

Imported as follow in a plugin.

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

Vue.use(VueMarkdown)
MichMich commented 5 years ago

Same here in a Laravel Mix / Vue project.

dargmuesli commented 4 years ago

92 proposes a fork where this issue is fixed.

ZeanQin commented 4 years ago

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

fguillen commented 4 years ago

I am using yarn, this worked for me

yarn add babel-runtime --save
che5ya commented 4 years ago

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

npm i babel-runtime --save
coolsoftwaretyler commented 4 years ago

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

bsansone commented 4 years ago

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.

clouedoc commented 4 years ago

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

yarn add babel-runtime --save

It then compiled and worked.

ballonura commented 4 years ago

Same here in a Nuxt 2.13+ project.

npm i babel-runtime fix it

pixelart7 commented 4 years ago

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!

slc3a2 commented 4 years ago

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

macOS 10.14 vue@2.6.11 vue-markdown@2.2.4 node@10.13.0

schl3ck commented 4 years ago

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.

mcasto commented 4 years ago

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.

OssiPesonen commented 3 years ago

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.

Lowell130 commented 3 years ago

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

thanks work for me, on Gridsome and Strapi

quiquelhappy commented 2 years ago

still an issue.