首页 > 编程语言 >SyntaxError: Error parsing JavaScript expression: Unexpected token, expected "," (3:16)

SyntaxError: Error parsing JavaScript expression: Unexpected token, expected "," (3:16)

时间:2023-08-09 21:33:24浏览次数:56  
标签:node core Unexpected 16 SyntaxError work modules vue compiler

项目环境

C:\Users\19139>node -v
v18.16.0

C:\Users\19139>pnpm -v
8.2.0

vue3+vite4打包报错

"vue": "3.3.4",
"vite": "4.0.4",
"rollup": "^3.27.2",

报错

D:\work\demo>npm run build

> [email protected] build D:\work\demo
> vite build --mode pro

Building [████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░] 11% | Time: 24.7s
Build failed. Please check the error message

error during build:
SyntaxError: Error parsing JavaScript expression: Unexpected token, expected "," (3:16)
    at createCompilerError (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:17:17)
    at processExpression (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:3128:7)
    at Object.transformOn (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:4706:23)
    at transformOn (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-dom\dist\compiler-dom.cjs.prod.js:2655:23)
    at buildProps (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:4366:48)
    at Array.postTransformElement (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:4028:32)
    at traverseNode (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1998:15)
    at traverseChildren (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1950:5)
    at traverseNode (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1992:7)
    at traverseChildren (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1950:5)
    at traverseNode (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1992:7)
    at traverseChildren (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1950:5)
    at traverseNode (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1992:7)
    at traverseNode (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1985:9)
    at traverseChildren (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1950:5)
    at traverseNode (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1992:7)
    at traverseChildren (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1950:5)
    at traverseNode (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1992:7)
    at traverseChildren (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1950:5)
    at traverseNode (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1992:7)
    at traverseChildren (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1950:5)
    at traverseNode (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1992:7)
    at traverseChildren (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1950:5)
    at traverseNode (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1992:7)
    at transform (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:1888:3)
    at Object.baseCompile (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-core\dist\compiler-core.cjs.prod.js:5202:3)
    at Object.compile (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-dom\dist\compiler-dom.cjs.prod.js:2935:23)
    at doCompileTemplate (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:3627:47)
    at Object.compileTemplate (D:\work\demo\node_modules\.pnpm\@[email protected]\node_modules\@vue\compiler-sfc\dist\compiler-sfc.cjs.js:3587:12)
    at compile (D:\work\demo\node_modules\.pnpm\@[email protected][email protected][email protected]\node_modules\@vitejs\plugin-vue\dist\index.cjs:167:35)
    at transformTemplateInMain (D:\work\demo\node_modules\.pnpm\@[email protected][email protected][email protected]\node_modules\@vitejs\plugin-vue\dist\index.cjs:156:18)
    at genTemplateCode (D:\work\demo\node_modules\.pnpm\@[email protected][email protected][email protected]\node_modules\@vitejs\plugin-vue\dist\index.cjs:2441:12)
    at transformMain (D:\work\demo\node_modules\.pnpm\@[email protected][email protected][email protected]\node_modules\@vitejs\plugin-vue\dist\index.cjs:2296:55)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `vite build --mode pro`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\19139\AppData\Roaming\npm-cache\_logs\2023-08-09T01_52_18_137Z-debug.log

解决办法

找到报错的js文件,对应方法添加打印对应报错信息
打印后,重新执行 npm run build , 报错更新图下

image

标签:node,core,Unexpected,16,SyntaxError,work,modules,vue,compiler
From: https://www.cnblogs.com/optre/p/17617646.html

相关文章

  • 160. 相交链表
    给你两个单链表的头节点 headA 和 headB ,请你找出并返回两个单链表相交的起始节点。如果两个链表不存在相交节点,返回 null 。图示两个链表在节点 c1 开始相交:题目数据 保证 整个链式结构中不存在环。示例1:输入:intersectVal=8,listA=[4,1,8,4,5],listB=[5,6,1,8,......
  • internal error, unexpected bytes at end of flate stream
     [query]Whatdoestheerrormean"websocket:internalerror,unexpectedbytesatendofflatestream"·Issue#643·gorilla/websockethttps://github.com/gorilla/websocket/issues/643[query]Whatdoestheerrormean"websocket:internaler......
  • 使用C#配合modbus协议的16进制代码生成crc16校验码的计算方法
    前言在网上也是查看了很多关于crc16校验的文章,但是好像都是对于有基础的人看的,我当时拿起直接使用,发现行不通,这对于零基础的不是很友好,所以决定贡献一篇,哈哈哈哈~~~publicuintCalcCRC16(stringhexCommand){byte[]pBuf=HexStringToByteArray(......
  • 产业共振 智能涌现!8月16日飞桨携手生态伙伴带来大模型企业应用创新实践
    当前,人工智能已经成为新一轮科技革命和产业变革的重要驱动力量,基于强算法、大算力和大数据的大模型成为人工智能发展的主流方向。AI大模型已经从拼参数发展到拼应用,进入大规模可复制的产业落地阶段。飞桨深度学习平台和文心大模型一直致力于发挥算法模型基础技术优势,助力广大企业将......
  • 16.Mycat进阶
    课程目标1、掌握不同数据分片策略的配置方式与特点2、Mycat扩缩容与数据导入导出3、理解Mycat注解的作用与应用场景4、读写分离的实现和原理5、Mycat核心原理分析总结内容定位适合在了解了Mycat的基本使用之后,想要深入学习Mycat的同学1分片策略详解Mycat权威指......
  • ubuntu22.04问题:Method https has died unexpectedly!
    问题当我们执行update的时候,有时候会遇到下面这种情况apt-getupdate命中:1http://mirrors.tuna.tsinghua.edu.cn/ubuntujammyInRelease命中:2http://mirrors.tuna.tsinghua.edu.cn/ubuntujammy-updatesInRelease命中:3http://mirrors.tuna.tsinghua.edu.cn/ubuntuj......
  • python:安装backgroundremover 0.2.4(Python 3.9.16)
    一,官方代码及文档:https://github.com/nadermx/backgroundremover二,安装backgroundremover的准备工作1,安装pytorch:https://blog.imgtouch.com/index.php/2023/08/03/rocky-linux-an-zhuang-pytorch-pytorch-2-1-python-3-9-16/2, 安装ffmpeg:https://blog.imgtouch.......
  • rocky linux:安装pytorch(pytorch 2.0.1 / Python 3.9.16)
    一,pytorch官网:https://pytorch.org/如图:根据自己的需求选择版本、平台、语言环境等信息,然后运行命令二,运行pip安装命令:[root@imgbin]#pip3installtorchtorchvisiontorchaudio--index-urlhttps://download.pytorch.org/whl/cpuLookinginindexes:https://......
  • Vue3+ElementPlus,Module parse failed: Unexpected token (3:27)
    一、环境vue3,ElementPlus,@vue/cli5.0.8,npm 9.6.7。我在复制elementplus官网的一些代码到vue3框架里测试时出现的问题。二、不报错方法图片位置删除lang=“ts”就不报错了 ......
  • P3180 [HAOI2016] 地图
    Problem给出\(n\)个点\(m\)条边的无向连通图,且每条边最多被包含在一个环中,每个点有颜色,有\(q\)次询问,每次询问给出一个点\(x\)和参数\(y\),假如将\(1\)到\(x\)所有简单路径上的边删去后,从\(x\)出发,能到达的所有点中,颜色编号小于等于\(y\)且出现次数为奇数或偶数......