VueJS - Module not found: Error: Can't resolve '@babel/runtime/regenerator'

时光毁灭记忆、已成空白 提交于 2020-03-26 02:37:03

问题


I have this error

Module not found: Error: Can't resolve '@babel/runtime/regenerator' in 'C:\wamp64\www\project-dev\modules\Gallery\Resources\Assets\Backend\Views\Album' when I execute this command npm run dev.

So to explain my laravel project directory:

app
modules
 auth
 backend
 gallery
themes
 admin
  node_modules
  resources
   js
    components
    router
     index.js
    store
    app.js
   sass
   views
  package.json
  webpack.mix.js

So in my router/index.js of vuejs app, I will includes routes from a module.

I make this:

import GalleryRoutes from "../../../../../modules/Gallery/Resources/Assets/Backend/routes";

// Vue Router
const router = new VueRouter({
    base: '/admin',
    mode: 'history',
    routes: [
        ...constantRoutes,
        ...GalleryRoutes,
    ],
    linkActiveClass: "active",
    linkExactActiveClass: "active",
});

routes.js file from Gallery module:

// Views
import AlbumIndex from './Views/Album/Index.vue'

// Routes
export default [
    // AlbumIndex
    {

        path: 'gallery/albums',
        component: AlbumIndex,
        name: 'backend.gallery.album.index',
        meta: {
            heading: 'Gallery',
            title: 'Albums',
            icon: 'fas fa-images',
            showed: true
        }
    }
];

But I get the error above.

I think this is a bug related to the node_modules folder, I'm not sure. It's possible to achieve what I want to do? (include .Vue or .js files from outside my root app directory).

PS: I try to make this to try to answer this question: Backend (VueJS) of laravel application with modules approach

Thank you to helping me :)


回答1:


It's looking for a dependency that is not installed. In your case you can do npm i babel-runtime --save to install that dependency you're missing.




回答2:


Installing whatwg-fetch fixed the issue for me



来源:https://stackoverflow.com/questions/57690008/vuejs-module-not-found-error-cant-resolve-babel-runtime-regenerator

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!