• 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。

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

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

     

  • 相关阅读:
    搭建PXE服务器安装UEFI启动的centos7
    6G:典型应用、关键技术与面临挑战
    微软用它取代了`Nginx`吞吐量提升了百分之八十!
    Typescript-----面试题
    静态语言和动态语言,解释和编译
    Java JVM中的栈空间怎么释放
    css3 中选择器间有空格与没空格的区别?
    分享从零开始学习网络设备配置--任务3.4 利用单臂路由实现部门间网络互访
    Linux中自旋锁实现的基本原理之经典
    HOLMES通过关联可疑信息流进行实时 APT 检测
  • 原文地址:https://blog.csdn.net/weixin_41184962/article/details/133748145