• vite + vu3 + ts 项目,npm run build 报错


    1、新建了vite 项目,build的时候报错: 

    npm ERR! demo1@0.0.0 build: `vue-tsc && vite build`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the demo1@0.0.0 build script.
    npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

    1. > demo1@0.0.0 build E:\learn\demo1\demo1
    2. > vue-tsc && vite build
    3. E:\learn\demo1\demo1\node_modules\@vue\language-core\out\generators\template.js:261
    4. tagOffsetsMap[tag] ??= [];
    5. ^^^
    6. SyntaxError: Unexpected token '??='
    7. at wrapSafe (internal/modules/cjs/loader.js:1001:16)
    8. at Module._compile (internal/modules/cjs/loader.js:1049:27)
    9. at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    10. at Module.load (internal/modules/cjs/loader.js:950:32)
    11. at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    12. at Module.require (internal/modules/cjs/loader.js:974:19)
    13. at require (internal/modules/cjs/helpers.js:101:18)
    14. at Object.<anonymous> (E:\learn\demo1\demo1\node_modules\@vue\language-core\out\index.js:30:14)
    15. at Module._compile (internal/modules/cjs/loader.js:1085:14)
    16. at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    17. npm ERR! code ELIFECYCLE
    18. npm ERR! errno 1
    19. npm ERR! demo1@0.0.0 build: `vue-tsc && vite build`
    20. npm ERR! Exit status 1
    21. npm ERR!
    22. npm ERR! Failed at the demo1@0.0.0 build script.
    23. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
    24. npm ERR! A complete log of this run can be found in:

     这个报错是 node 版本问题,一查 版本是 14.21.1 的,换成 16.0.0 的 问题解决

    这里更换 node 版本 强烈建议 使用 NVM 工具,切换 node 版本贼快,再也不用像之前那样 卸载node重装啦

    2、Refused to frame 'https://login.work.weixin.qq.com/' because it violates the following Content Security Policy directive: "frame-src 'self' *.oraybeta.com".

    项目在做 企业微信 第三方 登录接入,本地 跑 可以显示 登录面板,上到机器,安全策略原因,拒绝访问。

    解决方法:

    更改项目中的 k8s 配置,添加 报错的 域名 login.work.weixin.qq.com, 记得要空格隔开

    3、页面上线之后,页面空白,报错 Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec。

    之前试过 一直刷新 就能出来 页面

    这次 一直刷新都出不了了,重新上线就可以了

     

  • 相关阅读:
    ci-cd的流程
    Rust编程中的线程间通信
    Cartesi 2022 年 11 月回顾
    uview picker 组件实现只要省和市的两级数据联动选择器
    1651. Hopper 公司查询 III
    知识图谱从入门到应用——知识图谱的应用
    发送QQ邮件
    观察级水下机器人使用系列之七机械手臂
    SpringBoot SpringBoot 开发实用篇 5 整合第三方技术 5.23 SpringBoot 整合 RabbitMQ(direct 模式)
    [CISCN2019 华北赛区 Day2 Web1]Hack World 1 题目分析与详解
  • 原文地址:https://blog.csdn.net/weixin_41184962/article/details/133748145