最近开发一个老项目,发现之前好好的项目现在运行起来报错了 ,各种切换npm 源和 node版本都不行,百度和谷歌都没找到相关信息,报错如下,

error  in ./node_modules/@lit/reactive-element/decorators/state.js

Module parse failed: Unexpected token (6:27)
You may need an appropriate loader to handle this file type.
|  * Copyright 2017 Google LLC
|  * SPDX-License-Identifier: BSD-3-Clause
|  */function t(t){return r({...t,state:!0})}export{t as state};
| //# sourceMappingURL=state.js.map

说是处理不了当前文件。

 error  in ./node_modules/@lit/reactive-element/decorators/state.jsModule parse failed: Unexpected token (6:27)
You may need an appropriate loader to handle this file type.
|  * Copyright 2017 Google LLC
|  * SPDX-License-Identifier: BSD-3-Clause
|  */function t(t){return r({...t,state:!0})}export{t as state};
| //# sourceMappingURL=state.js.map
| 

发现是@lit这个模块下的文件报错,点开详情发现这里的是源文件,并不是es5语法。

看了下package.json里的版本号用的是^,意味着这个模块可以自动小版本升级。猜想应该是模块自动升级了,导致某些地方不兼容所以报错了,

最后发现项目中配置了,babel解析,这个插件输入出的是es6代码,需要用bable编译一下。

      {test: /\.js$/,loader: 'babel-loader',include: [[resolve('src'), resolve('/node_modules/_@lit')]],}

看报错信息是./node_modules/@lit/reactive-element ,原来新版的原路径改成了 @lit,旧版是_@lit 所以没有经过bable解析,导致报错。经过如下修改增加了新的解析路径,问题得到解决。

      {test: /\.js$/,loader: 'babel-loader',include: [[resolve('src'), resolve('/node_modules/_@lit'),resolve('/node_modules/@lit')]],}

error in ./node_modules/@lit/reactive-element/decorators/state.jsModule parse failed: Unexpected相关推荐

  1. ERROR in ./node_modules/element-ui/lib/theme-chalk/fonts/element-icons.ttf 1:0 Module parse failed:

    在使用 webpack 搭建 vue 项目时,添加了element-ui 在启动 webpack-dev-server 后报错 ERROR in ./node_modules/element-ui/l ...

  2. Vue 踩坑笔记: 引入 ElementUI 时打包失败修复记录(ERROR in ./node_modules/element-ui/lib/theme-chalk/index.css)

    Vue 踩坑笔记: 引入 ElementUI 时打包失败修复记录(ERROR in ./node_modules/element-ui/lib/theme-chalk/index.css Module ...

  3. Error waiting for a debug connection: Bad state: No element

    Error waiting for a debug connection: Bad state: No element 报错如图: 解决方案: 连接的设备(包括手机或模拟器)设置好开发者模式 设置开发 ...

  4. GEE报错Tile error: Error in map(ID=198102T01):Element.copyProperties: The source parameter is require

    人菜且爱玩,分享一些常见的GEE报错现象以及解决方案,希望对大家能够有所帮助. 本文以ERA5-land数据集为例介绍The source parameter is require应该如何解决. GE ...

  5. 运行ant-design-pro报错ERROR in ./node_modules/swagger-ui-react/swagger-ui.js 2:107055-107070Module not

    报错内容:  ERROR in ./node_modules/swagger-ui-react/swagger-ui.js 2:107055-107070 Module not found: Erro ...

  6. 解决this._data.$$state...“Error: [vuex] do not mutate vuex store state outside mutation handlers.“ 报错

    今天遇到了这样一个报错: [Vue warn]: Error in callback for watcher "function () {return this._data.$$state; ...

  7. Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):(Emitted value instead o

    Module Error (from ./node_modules/vue-loader/lib/loaders/templateLoader.js):(Emitted value instead o ...

  8. vscode报错ERROR in node_modules/@types/node/ts3.5/globals.global.d.ts:1:13 - error TS2403: Subsequent

    报错信息 ERROR in node_modules/@types/node/ts3.5/globals.global.d.ts:1:13 - error TS2403: Subsequent var ...

  9. 解决ERROR in ./node_modules/vuex/dist/vuex.esm.js

    当你安装vuex时,安装完成后可能会出现这样的报错 ERROR in ./node_modules/vuex/dist/vuex.esm.js 两种原因: 1.如果你是用的是vue2,那应该安装vue ...

最新文章

  1. hibernate详解
  2. lec 3 of game design
  3. 强烈推荐!分享一个持续连载的《特征工程小锦囊》项目,代码已开源!
  4. POJ - 2352 Stars(线段树/树状数组)
  5. [Redux/Mobx] Mobx和Redux有什么区别?
  6. 2017.10.30 覆盖问题 思考记录
  7. 666_update
  8. 网络管理员考试案例梳理、真题透解与强化训练
  9. Acwing - 最长公共子序列
  10. 开坑,写点Polymer 1.0 教程第2篇(上)——hello world篇
  11. 笔记本电池续航测试软件,电池续航能力测试及整机试用总结
  12. 唤起Android手机中已安装的地图应用
  13. CorelDRAW2021新增功能及增强内容
  14. uva 437,巴比伦塔
  15. 2.6.2 QDate类与QDateEdit控件介绍(日期处理)
  16. 基于C#(Visual Studio 2013)的AutoCAD2016二次开发(二)创建直线
  17. 灵遁者哲学书籍《 重构世界》:意识是物质逆熵存在的本征
  18. Unity中SetPassCall, Batches的区别,它们与Draw call 的关系
  19. JSON与JSONP
  20. 2012年西安校园招聘会

热门文章

  1. 【洛谷】P2197 【模板】nim 游戏
  2. 软考高级 真题 2013年上半年 信息系统项目管理师 综合知识
  3. 骄傲! 咱中国人的区块链技术闯进了国际学术顶会!
  4. Android实现百度地图定位(墨雪亲测)
  5. 哥德尔不完全性定理探索数学边界
  6. linux如何访问共享目录权限设置密码,文件夹如何设置密码_在共享文件夹上怎么设置密码访问 - 驱动管家...
  7. 直播app开发搭建,纯css/html实现侧边导航栏
  8. 统计一行字符串中单词的个数
  9. linux系统禁用声卡,Ubuntu Linux系统下声卡独占的解决方法
  10. php图片是啥,PHP图片操作