«tns preview» не работает при переносе существующего проекта Angular с NativeScript - PullRequest
1 голос
/ 27 сентября 2019

Я мигрирую существующий проект Angular с NativeScript, но когда я нажимаю на команду tns preview, он выдает две ошибки.Один из Angular, а другой из Java.

Журнал ошибок находится здесь:

src/app/components/widget/toolbar/toolbar.component.ts:2:28 - error TS2307: Cannot find module 'src/app/services/ipc.service'.

2 import { IpcService } from 'src/app/services/ipc.service';
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/components/widget/toolbar/toolbar.component.ts:4:34 - error TS2307: Cannot find module 'src/app/services/user-state.service'.

4 import { UserStateService } from 'src/app/services/user-state.service';
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/components/widget/toolbar/toolbar.component.ts:5:34 - error TS2307: Cannot find module 'src/app/services/websocket.service'.

5 import { WebSocketService } from 'src/app/services/websocket.service';
                                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/components/widget/toolbar/toolbar.component.ts:6:39 - error TS2307: Cannot find module 'src/app/services/authentication.service'.

6 import { AuthenticationService } from 'src/app/services/authentication.service';
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/components/widget/transition-tab/transition-tab.component.ts:2:31 - error TS2307: Cannot find module 'src/app/services/common.service'.

2 import { CommonService } from 'src/app/services/common.service';
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/services/authentication.service.ts:4:29 - error TS2307: Cannot find module 'src/environments/environment'.

4 import { environment } from 'src/environments/environment';
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/services/authentication.service.ts:6:31 - error TS2307: Cannot find module 'src/app/services/common.service'.

6 import { CommonService } from 'src/app/services/common.service';
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/services/cancelStreamPacketStructures.ts:2:23 - error TS2307: Cannot find module 'src/app/services/sotpConstants'.

2 import * as SOTP from 'src/app/services/sotpConstants';
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/services/common.service.ts:3:23 - error TS2307: Cannot find module 'src/app/services/sotpConstants'.

3 import * as SOTP from 'src/app/services/sotpConstants';
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/services/createWindow.service.ts:6:39 - error TS2307: Cannot find module 'src/app/services/authentication.service'.

6 import { AuthenticationService } from 'src/app/services/authentication.service';
                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/services/quotePacketStructures.ts:2:23 - error TS2307: Cannot find module 'src/app/services/sotpConstants'.

2 import * as SOTP from 'src/app/services/sotpConstants';
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/services/tradePacketStructures.ts:2:23 - error TS2307: Cannot find module 'src/app/services/sotpConstants'.

2 import * as SOTP from 'src/app/services/sotpConstants';
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/services/websocket.service.ts:7:23 - error TS2307: Cannot find module 'src/app/services/sotpConstants'.

7 import * as SOTP from 'src/app/services/sotpConstants';
                        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/app/services/websocket.service.ts:10:31 - error TS2307: Cannot find module 'src/app/precision.pipe'.

10 import { PrecisionPipe } from 'src/app/precision.pipe';
                                 ~~~~~~~~~~~~~~~~~~~~~~~~

Webpack compilation complete. Watching for file changes.
Webpack build done!
Project successfully prepared (android)
Start sending initial files for platform android.
Successfully sent initial files for platform android.
LOG from device Galaxy On8: HMR: Hot Module Replacement Enabled. Waiting for signal.
LOG from device Galaxy On8: HMR: Hot Module Replacement Enabled. Waiting for signal.
LOG from device Galaxy On8: An uncaught Exception occurred on "main" thread.
Unable to start activity ComponentInfo{org.nativescript.preview/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
Error: Main entry is missing. App cannot be started. Verify app bootstrap.

StackTrace:
java.lang.RuntimeException: Unable to start activity ComponentInfo{org.nativescript.preview/com.tns.NativeScriptActivity}: com.tns.NativeScriptException: Calling js method onCreate failed
Error: Main entry is missing. App cannot be started. Verify app bootstrap.
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3320)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3416)
        at android.app.ActivityThread.access$1100(ActivityThread.java:230)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1822)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:148)
        at android.app.ActivityThread.main(ActivityThread.java:7409)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
Caused by: com.tns.NativeScriptException: Calling js method onCreate failed
Error: Main entry is missing. App cannot be started. Verify app bootstrap.
        at com.tns.Runtime.callJSMethodNative(Native Method)
        at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1209)
        at com.tns.Runtime.callJSMethodImpl(Runtime.java:1096)
        at com.tns.Runtime.callJSMethod(Runtime.java:1083)
        at com.tns.Runtime.callJSMethod(Runtime.java:1063)
        at com.tns.Runtime.callJSMethod(Runtime.java:1055)
        at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:20)
        at android.app.Activity.performCreate(Activity.java:6904)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1136)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3267)
        ... 9 more

LOG from device Galaxy On8: HMR: Hot Module Replacement Enabled. Waiting for signal.
LOG from device Galaxy On8: HMR: Hot Module Replacement Enabled. Waiting for signal.

Он показывает, что модули не найдены, но я проверил, что модули работают правильно и работают на"ng serve", но они не работают с "tns preview".

1 Ответ

0 голосов
/ 27 сентября 2019

похоже, что он не находит путь попытки модуля, например "../service/serviceComponent" и т. Д. Может ли он решить эту проблему и попробовать tns preview --bundle

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...