今天在学习运用vue的nuxt/koa框架,初始化项目之后,在执行 $> npm run dev 时报错,错误详细信息如下:

点击查看报错的详细内容
> npm run dev
Debugger attached. > ice@1.1.0 dev
> backpack dev Debugger attached.
Debugger attached. ERROR Failed to compile with 1 errors 下午5:52:10
error in ./server/index.js Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In E:\Vue\***\node_modules\backpack-core\babel.js
at createDescriptor (E:\Vue\***\node_modules\@babel\core\lib\config\config-descriptors.js:196:11)
at createDescriptor.next (<anonymous>)
at step (E:\Vue\***\node_modules\gensync\index.js:261:32)
at E:\Vue\***\node_modules\gensync\index.js:273:13
at async.call.result.err.err (E:\Vue\***\node_modules\gensync\index.js:223:11) Debugger attached.
Waiting for the debugger to disconnect...
node:internal/modules/cjs/loader:936
throw err;
^

先是找到了出错的模块文件的那行代码,发现是官方包,那第一个想到的肯定是版本不一致。所以先把backpack包的版本升级到了0.7.0,即运行命令:

npm install backpack-core@0.7.0

然后运行一次 npm run dev, 发现问题依然存在:

点击查看Error信息
Error: Cannot find module 'E:\Vue\build\main.js'
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Waiting for the debugger to disconnect...

好烦,还是没解决问题。看报错信息的意思是 Plugin/Preset files are not allowed to export objects, only functions.

最后,根据这个报错信息在网上找到了类似问题的解决办法,修改nuxt.config.js中如下配置代码:

点击查看代码
    /*
** Run ESLINT on save
*/
extend (config, ctx) {
// if (ctx.isClient) { //将原来生成的这行注释,改为下行的判断即可
if(ctx.Client&&ctx.isDev) {
config.module.rules.push({
enforce: 'pre',
test: /\.(js|vue)$/,
loader: 'eslint-loader',
exclude: /(node_modules)/
})
}
}

再次运行,终于跑起来了。

点击查看运行结果
> npm run dev
Debugger attached. > ice@1.1.0 dev
> backpack dev Debugger attached.
Debugger attached. DONE Compiled successfully in 3219ms 下午5:53:46 Debugger attached.
i Preparing project for development 17:53:59
i Initial build may take a while 17:53:59 i NuxtJS collects completely anonymous data about usage. 17:54:03
This will help us improve Nuxt developer experience over time.
Read more on https://git.io/nuxt-telemetry ? Are you interested in participating? (Y/n) y
? Are you interested in participating? Yes √ Builder initialized 17:54:14
√ Nuxt files generated 17:54:14 √ Client
Compiled successfully in 10.45s √ Server
Compiled successfully in 9.59s i Waiting for file changes 17:54:32
Server listening on 127.0.0.1:3000

解决nuxt/koa架构初始项目运行报错问题的更多相关文章

  1. 解决升级到Xcode10,react native项目运行报错问题

    今天刚升级到Xcode10,就遇到两个报错问题 错误一:Xcode 10: Build input file double-conversion cannot be found error: Buil ...

  2. vue项目运行报错:Module bulid failed: Error: Node Sass does not yet support your current environment

    出错起因:      从GitLab clone项目 --> 用 npm install 命令下载依赖包 --> #npm run dev,报错 错误截图: 解决方法:   思路:单独 i ...

  3. 导入maven的java web项目运行报错找不到Spring监听器

    本地成功运行的一个maven项目,在另一台机器复制下来并导入,运行时报错: java.lang.ClassNotFoundException: org.springframework.web.cont ...

  4. 创建springboot2.1项目运行报错

    刚创建好一个项目,运行就报错:in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/logging ...

  5. QMUI android 框架 git下载项目运行报错解决 input String“”

    1.编译源码,input String“” 解决办法: 打开qmuidemo里面的gradle文件,注释掉顶部的 //def cmd = 'git rev-list HEAD --count'//de ...

  6. myeclipse中文名字项目运行报错

    今天由于项目进行分支,负责开发迭代的功能对应不同的分支项目,没想到的是分支项目名称加上了功能的中文名字.要使用了resin发布项目的时候,报了 java.io.CharConversionExcept ...

  7. vue 项目运行报错

    'vue-cli-service' 不是内部或外部命令,也不是可运行的程序 或批处理文件. 运行Vue项目文件的时候报如下错误 需要先用淘宝镜像来运行:cnpm install 然后运行成功后 就可以 ...

  8. node项目运行报错

    Cannot find module 'webpack/bin/config-optimist' 在项目里面运行npm i webpack-dev-server Cannot find module ...

  9. prettier包升级后vue项目运行报错

    今天用vue-cli新建vue项目的时候,发现项目怎么都跑不起来. 最后通过与以前项目作比较,发现prettier这个依赖的版本从原来的1.12.0升级成了1.13.1.我也不太清楚为什么升级后项目跑 ...

随机推荐

  1. 【python基础】第10回 周总结

    路径 可以简单的理解为路径就是某个事物所在的具体位置(坐标) 1.相对路径:必须有一个参考系,就是相对于自己的目标文件的位置. 2.绝对路劲:不需要有参考系,是指文件在硬盘上真正存在的路径. 计算机五 ...

  2. Qt数据可视化(散点图、折线图、柱状图、盒须图、饼状图、雷达图)开发实例

    ​  目录 散点图 折线图 柱状图 水平柱状图 水平堆叠图 水平百分比柱状图 盒须图 饼状图 雷达图 Qt散点图.折线图.柱状图.盒须图.饼状图.雷达图开发实例. 在开发过程中我们会使用多各种各样的图 ...

  3. STM32与物联网01-ESP8266基本操作

    ESP8266物联网简介 ESP8266简介 ESP8266 是上海乐鑫公司开发的一款具有 WiFi 功能的控制芯片,它带有完整的 TCP/IP 协议栈,因此可以用作物联网开发. ESP8266 本身 ...

  4. 用户数据交互 Scanner

    # 用户交互 Scanner ``` java package study5ran2yl.study; import java.util.Scanner; public class demo09 { ...

  5. MicTR01 Tester 开发套件(振弦采集读数仪)使用说明

    MicTR01 是系列振弦模块 VM5/6/7和电子标签读写模块 TR01 开发测试.开发套件.使用 STC8 位 51 单片机为核心部件,演示上述各个型号模块的基本用法,包括了模块使用时的硬件连接和 ...

  6. Linux系列之添加和删除软件命令

    前言 在基于Debian的Linux发行版中,默认的软件管理器是Advanced Packaging Tool, 也就是apt.本文将简单介绍下面有关添加和删除软件的命令: apt-cache sea ...

  7. AtCoder Beginner Contest 260 G // imos(累积和算法)

    题目传送门:G - Scalene Triangle Area (atcoder.jp) 题意: 给定大小为N*N的OX矩阵,若矩阵的(s,t)处为O,其覆盖范围为:满足以下条件的所有位置(i,j) ...

  8. Matplotlib(基本用法)

    Matplotlib 是数据分析绘图的常见模块,可以算是 2D-绘图(Python)领域使用最广泛的套件,可以将数据图形化,并且提供多样化的输出格式,利于数据的显示并分析. 接下来展示的是Matplo ...

  9. python 装饰器理解

    简介 装饰器可以在不修改原有代码的基础上添加新的功能,可以将重复重用的代码抽取出来,进一步解耦,方便维护,一般适用于插入日志.性能测试.事务处理.缓存等 装饰器的前提 闭包 一般来说,当一个函数嵌套另 ...

  10. 【达人专栏】还不会用Apache Dolphinscheduler吗,大佬用时一个月写出的最全入门教学【二】

    02 Master启动流程 2.1 MasterServer的启动 在正式开始前,笔者想先鼓励一下大家.我们知道启动Master其实就是启动MasterServer,本质上与其他SpringBoot项 ...