Flowm / satvis

Satellite orbit visualization and pass prediction with Cesium.js
https://satvis.space
MIT License
297 stars 103 forks source link

Uncaught TypeError: Cannot read property 'Viewer' of undefined #40

Closed ccmostmosthandsome closed 4 years ago

ccmostmosthandsome commented 4 years ago

node 11.11.0/10.0.0/10.10.0 npm 6.7.0 /5.6.0/ cnpm install npm install all cant start item

error: CesiumController.js:25 Uncaught TypeError: Cannot read property 'Viewer' of undefined at new CesiumController (CesiumController.js:25) at Object.install (VueCesiumController.js:6) at Function.Vue.use (vue.esm.js:5100) at eval (Cesium.vue?C:/Users/123/Desktop/orbforce/node_modules/babel-loader/lib??ref--0!C:/Users/123/Desktop/orbforce/node_modules/vue-loader/lib??vue-loader-options:239) at Module../node_modules/babel-loader/lib/index.js?!./node_modules/vue-loader/lib/index.js?!./src/components/Cesium.vue?vue&type=script&lang=js& (app.3d870e7c.js?WB_REVISION=3d870e7c14472ee0fd3e:862) at webpack_require (app.3d870e7c.js?WB_REVISION=3d870e7c14472ee0fd3e:80) at eval (VM1282 Cesium.vue:2) at Module../src/components/Cesium.vue?vue&type=script&lang=js& (app.3d870e7c.js?WB_REVISION=3d870e7c14472ee0fd3e:2395) at webpack_require (app.3d870e7c.js?WB_REVISION=3d870e7c14472ee0fd3e:80) at eval (VM1282 Cesium.vue:3)

webpack_require.r(webpack_exports); / harmony export (binding) / webpack_require.d(webpack_exports, "CesiumController", function() { return CesiumController; }); / harmony import / var CesiumWEBPACK_IMPORTED_MODULE_0 = webpack_require(/! Cesium / "Cesium"); / harmony import / var CesiumWEBPACK_IMPORTED_MODULE0default = /#PURE/webpack_require.n(CesiumWEBPACK_IMPORTED_MODULE_0); / harmony import / var dayjsWEBPACK_IMPORTED_MODULE_1 = webpack_require(/! dayjs / "./node_modules/dayjs/dayjs.min.js"); / harmony import / var dayjsWEBPACK_IMPORTED_MODULE1default = /#PURE/webpack_require.n(dayjsWEBPACK_IMPORTED_MODULE_1); / harmony import / var dayjs_plugin_utcWEBPACK_IMPORTED_MODULE_2 = webpack_require(/! dayjs/plugin/utc / "./node_modules/dayjs/plugin/utc.js"); / harmony import / var dayjs_plugin_utcWEBPACK_IMPORTED_MODULE2default = /#PURE/webpack_require.n(dayjs_plugin_utcWEBPACK_IMPORTED_MODULE_2); / harmony import / var _util_DeviceDetectWEBPACK_IMPORTED_MODULE_3 = webpack_require(/! ./util/DeviceDetect / "./src/modules/util/DeviceDetect.js"); / harmony import / var _SatelliteManagerWEBPACK_IMPORTED_MODULE_4 = webpack_require(/! ./SatelliteManager / "./src/modules/SatelliteManager.js"); // Import webpack externals

code from CesiumController.js when builded: dayjsWEBPACK_IMPORTED_MODULE1default.a.extend(dayjs_plugin_utcWEBPACK_IMPORTED_MODULE2default.a); class CesiumController { constructor() { this.minimalUI = _util_DeviceDetectWEBPACK_IMPORTED_MODULE_3["DeviceDetect"].inIframe() || _util_DeviceDetectWEBPACK_IMPORTED_MODULE_3["DeviceDetect"].isIos(); //检测设备

this.minimalUIAtStartup = _util_DeviceDetect__WEBPACK_IMPORTED_MODULE_3__["DeviceDetect"].inIframe(); //检测设备
// 声明Cesium地方,作为其本身的属性

this.viewer = new Cesium__WEBPACK_IMPORTED_MODULE_0___default.a.Viewer("cesiumContainer",  (please attention)

if you also find the problem, can y tell me if its solved ! thank you!

ccmostmosthandsome commented 4 years ago

Error will not occur when i remove import Cesium from "Cesium"; line in cesiumController.js, why is that?

Flowm commented 4 years ago

Ran into the same issue when upgrading from Cesium 1.61.0 to 1.65.0. Likeley caused by their switch to ES6 modules in Cesium 1.63.0.

Instead of loading Cesium as a separate script, it is now built with webpack which resolved the error for me. Unfortunately CesiumSensorVolumes does not work yet with the new structure yet. I disabled it until I have more time to look into this.