当前位置: 首页 > news >正文

Mars3d项目启动上的一些坑

前言

最近新入职了一家公司,公司新开了有个未来城市的项目,需要用到3D城市建模,公司老总选了Mars3d作为前端框架,项目分给我了,又是一个全新的领域,开搞吧!
下面是自己遇到的几个小问题,记录一下:

  • 1 npm install copy-webpack-plugin --save -dev 时报错

在这里插入图片描述解决办法:npm install copy-webpack-plugin --save -dev --legacy-peer-deps

  • 2 第二个小错误就是很简单的粗心了,报错代码:const path = require(‘path’)SyntaxError: Identifier ‘path’ has already been declared解决办法:检查一下代码,就是自己多写了一遍这个声明语句,把重复的代码删除就好了。

  • 3 ERROR TypeError: compilation.getCache is not a function
    在这里插入图片描述
    解决办法:出现这个错误一般是我们的webpack和copy-webpack-plugin的版本不匹配导致的,这个时候我们只需要删除自己的copy-webpack-plugin,然后安装一个低版本的即可(这可能是第一个问题安装的后遗症
    两条指令:卸载:npm uninstall copy-webpack-plugin,安装:我安装的是copy-webpack-plugin@5.0.0,我的webpack版本是

  • 4 ERROR Error: [copy-webpack-plugin] patterns must be an array
    解决办法:这个是说我们的配置 new CopyWebpackPlugin()的参数必须是一个数组,我们从官网拷贝过来的代码好像是

        new CopyWebpackPlugin({patterns: [{ from: path.join(cesiumSourcePath, 'Workers'), to: path.join(config.output.path, cesiumRunPath, 'Workers') },{ from: path.join(cesiumSourcePath, 'Assets'), to: path.join(config.output.path, cesiumRunPath, 'Assets') },{ from: path.join(cesiumSourcePath, 'ThirdParty'), to: path.join(config.output.path, cesiumRunPath, 'ThirdParty') },{ from: path.join(cesiumSourcePath, 'Widgets'), to: path.join(config.output.path, cesiumRunPath, 'Widgets') }]}),

改成这样就好了

      new CopyWebpackPlugin([{ from: path.join(cesiumSourcePath, 'Workers'), to: path.join(config.output.path, cesiumRunPath, 'Workers') },{ from: path.join(cesiumSourcePath, 'Assets'), to: path.join(config.output.path, cesiumRunPath, 'Assets') },{ from: path.join(cesiumSourcePath, 'ThirdParty'), to: path.join(config.output.path, cesiumRunPath, 'ThirdParty') },{ from: path.join(cesiumSourcePath, 'Widgets'), to: path.join(config.output.path, cesiumRunPath, 'Widgets') }])
  • 5
    These dependencies were not found:
    @turf/turf in ./node_modules/mars3d/dist/mars3d.js
    *mars3d-cesium in ./node_modules/mars3d/dist/mars3d.js, ./src/main.js
    To install them, you can run: npm install --save @turf/turf mars3d-cesium
    这个很简单就跟着运行这条指令就好了。 npm install --save @turf/turf mars3d-cesium

  • 6 还有问题我会继续更新

http://www.lryc.cn/news/44487.html

相关文章:

  • 通俗易懂【Springboot】 单文件下载和批量下载(多个文件合成一个压缩包下载)
  • CnOpenData中国行政区划shp数据
  • GPT-4零失误通关大厂模拟面试,offer拿到手软?与AGI首次接触
  • Hardhat 环境搭建及教程示例
  • 复杂链表的复制-剑指Offer35-java
  • 【Linux】进程理解与学习Ⅰ-进程概念
  • WebKitX ActiveX 6.0 X86 Crack
  • 开源项目:数据库表结构生成文档工具
  • spring的两种拦截器HandlerIntercepter和MethodIntercepter
  • 初级算法-字符串
  • 华为OD机试题 - 寻找目标字符串(JavaScript)| 机考必刷
  • 删除Terminating状态的namespace:cattle-system
  • MiniOB 并发B+树实现解析
  • SpringCloud负载均衡服务调用——Ribbon
  • 各种邮箱服务软件对比
  • 相机单独标定的实现过程[autoware标定]、tmp文件的查看方式
  • 4.10.1、IP 多播技术的相关基本概念
  • PIGOSS BSM监控国产数据库Oscar
  • Spring Boot中文件上传
  • Github上传大文件(>25MB)教程
  • 面试官:mysql索引会缓存内存吗?
  • bs4解析数据和csv文件
  • Linux中Buffer和Cache的区别
  • Docker 镜像使用
  • Java阶段一Day10
  • 触摸屏与PLC之间如何快速实现无线PPI通信?
  • 【华为OD机试 2023最新 】 羊、狼、农夫过河(C++ 100%)
  • Java中关于try、catch、finally中的细节分析
  • Zookeeper原理
  • 关于FPGA如何快速生成模块的例化模板(实用)