首页 > 解决方案 > 更新 XCode、NativeScript-socketio 后出错?

问题描述

最近将我的 Macbook 更新为 Big Sur 11.4,并将我的 xcode 更新为 12.5.1。我不确定这是否是导致它的原因,但是我的应用程序似乎不再运行了。它可以编译,但是当我运行 tns debug ios 时,它会传输到模拟器,打开,然后立即崩溃并出现以下错误:

CONSOLE LOG file: node_modules/nativescript-vue-devtools/index.js:75:24: TypeError: this.socket.connect is not a function. (In 'this.socket.connect()', 'this.socket.connect' is undefined)
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1   0x11054502e NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2   0x110585e18 NativeScript::FFICallback<NativeScript::ObjCMethodCallback>::ffiClosureCallback(ffi_cif*, void*, void**, void*)
3   0x110f815a2 ffi_closure_unix64_inner
4   0x110f81fca ffi_closure_unix64
5   0x11401178a __CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION__
6   0x11401127c __CFRunLoopDoTimer
7   0x11401081a __CFRunLoopDoTimers
8   0x11400ae69 __CFRunLoopRun
9   0x11400a1a7 CFRunLoopRunSpecific
10  0x11e3ccd85 GSEventRunModal
11  0x115bae4df -[UIApplication _run]
12  0x115bb339c UIApplicationMain
13  0x110f81e0d ffi_call_unix64
14  0x139f2c250
JavaScript stack trace:
srcBackendJs(file:///app/vendor.js:56126:2296)
at __webpack_require__(file: app/webpack:/webpack/bootstrap:19:0)
at file: app/webpack:/webpack/bootstrap:83:0
at ../node_modules/@vue/devtools/build/backend.js(file:///app/vendor.js:52613:88)
at __webpack_require__(file: app/webpack/bootstrap:750:0)
at fn(file: app/webpack/bootstrap:120:0)
at connect(file: node_modules/@vue/devtools/index.js:17:12)
at setupDevtools(file: node_modules/nativescript-vue-devtools/index.js:63:23)
at invoke(file: node_modules/@nativescript/core/timer/timer.ios.js:54:53)
at file: node_modules/@nativescript/core/timer/timer.ios.js:18:12
at UIApplicationMain([native code])
at run(file: node_modules/@nativescript/core/application/application.ios.js:312:26)
at file: node_modules/nativescript-vue/dist/index.js:12597:2
at file: node_modules/nativescript-vue-devtools/index.js:92:25
at file:///app/bundle.js:21747:10
at ./main.js(file:///app/bundle.js:21751:34)
at __webpack_require__(file: app/webpack/bootstrap:750:0)
at checkDeferredModules(file: app/webpack/bootstrap:43:0)
at webpackJsonpCallback(file: app/webpack/bootstrap:30:0)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at moduleEvaluation([native code])
at [native code]
at asyncFunctionResume([native co<…&gt;
JavaScript error:
file:///app/vendor.js:56126:2296: JS ERROR TypeError: undefined is not an object (evaluating 'socket.on')
***** Fatal JavaScript exception - application has been terminated. *****
Native stack trace:
1   0x11054502e NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
2   0x110596f94 -[TNSRuntime executeModule:referredBy:]
3   0x10f714653 main
4   0x114926bbd start
JavaScript stack trace:
UIApplicationMain(file: node_modules/@nativescript/core/application/application.ios.js:312:26)
at run(file: node_modules/@nativescript/core/application/application.ios.js:312:26)
at file: node_modules/nativescript-vue/dist/index.js:12597:2
at file: node_modules/nativescript-vue-devtools/index.js:92:25
at file:///app/bundle.js:21747:10
at ./main.js(file:///app/bundle.js:21751:34)
at __webpack_require__(file: app/webpack/bootstrap:750:0)
at checkDeferredModules(file: app/webpack/bootstrap:43:0)
at webpackJsonpCallback(file: app/webpack/bootstrap:30:0)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at moduleEvaluation([native code])
at [native code]
at asyncFunctionResume([native code])
at [native code]
at promiseReactionJob([native code])
JavaScript error:
file: node_modules/@nativescript/core/application/application.ios.js:312:26: JS ERROR Error
(CoreFoundation) *** Terminating app due to uncaught exception 'NativeScript encountered a fatal error: Error
at
UIApplicationMain(file: node_modules/@nativescript/core/application/application.ios.js:312:26)
at run(file: node_modules/@nativescript/core/application/application.ios.js:312:26)
at file: node_modules/nativescript-vue/dist/index.js:12597:2
at file: node_modules/nativescript-vue-devtools/index.js:92:25
at file:///app/bundle.js:21747:10
at ./main.js(file:///app/bundle.js:21751:34)
at __webpack_require__(file: app/webpack/bootstrap:750:0)
at checkDeferredModules(file: app/webpack/bootstrap:43:0)
at webpackJsonpCallback(file: app/webpack/bootstrap:30:0)
at anonymous(file:///app/bundle.js:2:61)
at evaluate([native code])
at moduleEvaluation([native code])
at [native code]
at asyncFunctionResume([native code])
at [native code]
at promiseReactionJob([native code])
', reason: '(null)'
*** First throw call stack:
(
0   CoreFoundation                      0x00000001140a2fba __exceptionPreprocess + 242
1   libobjc.A.dylib                     0x0000000113f57ff5 objc_exception_throw + 48
2   NativeScript                        0x000000011054556f _ZN12NativeScript30report<…&gt;
NativeScript caught signal 6.
Native Stack:
1   0x110595be1 sig_handler(int)
2   0x7fff60335d7d _sigtramp
3   0xffff00001fa5
4   0x114a5bcb5 abort
5   0x11475b692 abort_message
6   0x11474cdfd demangling_unexpected_handler()
7   0x113f3dace _objc_terminate()
8   0x11475aaa7 std::__terminate(void (*)())
9   0x11475d174 __cxa_get_exception_ptr
10  0x11475d13b __cxxabiv1::exception_cleanup_func(_Unwind_Reason_Code, _Unwind_Exception*)
11  0x113f58119 objc_exception_throw
12  0x11054556f NativeScript::reportFatalErrorBeforeShutdown(JSC::ExecState*, JSC::Exception*, bool)
13  0x110596f94 -[TNSRuntime executeModule:referredBy:]
14  0x10f714653 main
15  0x114926bbd start
JS Stack:

好像跟 NativeScript-SocketIo 有关系?以下是有问题的代码,但它在 vendor.js 中


  Common.prototype.connect = function () {
    this.socket.connect();
  };

  Common.prototype.disconnect = function () {
    this.socket.disconnect();
  };

  return Common;
}();

标签: javascriptnode.jsvue.js

解决方案


推荐阅读