deep-foundation / deep-memo-app

The Unlicense
11 stars 8 forks source link

Error: Text content does not match server-rendered HTML. #44

Closed FreePhoenix888 closed 1 year ago

FreePhoenix888 commented 1 year ago

при попытке запуска npx cap sync я получил ошибку

gitpod /workspace/dev/packages/nextjs (main) $ npx cap sync
[error] Could not find the web assets directory: ./out.
        Please create it and make sure it has an index.html file. You can change the path of this directory in
        capacitor.config.ts (webDir option). You may need to compile the web assets for your app (typically npm run
        build). More info: https://capacitorjs.com/docs/basics/workflow#sync-your-project

Увидел, что index.html находится в app/server/pages/ (при npm run build), в то время как в капаситор конфиге указана папка out

Изменил в кпаситор конфиге путь на app/server/pages/ Ошибки нет:

gitpod /workspace/dev/packages/nextjs (main) $ npx cap sync
✔ Copying web assets from pages to android/app/src/main/assets/public in 13.16ms
✔ Creating capacitor.config.json in android/app/src/main/assets in 1.23ms
✔ copy android in 44.38ms
✔ Updating Android plugins in 9.23ms
[info] Found 12 Capacitor plugins for android:
       @capacitor-community/contacts@2.0.0
       @capacitor/action-sheet@4.1.0
       @capacitor/camera@4.1.4
       @capacitor/clipboard@4.1.0
       @capacitor/device@4.1.0
       @capacitor/dialog@4.1.0
       @capacitor/geolocation@4.1.0
       @capacitor/haptics@4.1.0
       @capacitor/local-notifications@4.1.4
       @capacitor/network@4.1.0
       @capacitor/push-notifications@4.1.2
       @capacitor/screen-reader@4.1.2
✔ update android in 76.87ms
✔ Copying web assets from pages to ios/App/App/public in 10.87ms
✔ Creating capacitor.config.json in ios/App/App in 624.96μs
✔ copy ios in 29.09ms
✔ Updating iOS plugins in 8.33ms
[info] Found 12 Capacitor plugins for ios:
       @capacitor-community/contacts@2.0.0
       @capacitor/action-sheet@4.1.0
       @capacitor/camera@4.1.4
       @capacitor/clipboard@4.1.0
       @capacitor/device@4.1.0
       @capacitor/dialog@4.1.0
       @capacitor/geolocation@4.1.0
       @capacitor/haptics@4.1.0
       @capacitor/local-notifications@4.1.4
       @capacitor/network@4.1.0
       @capacitor/push-notifications@4.1.2
       @capacitor/screen-reader@4.1.2
[warn] Skipping pod install because CocoaPods is not installed
[warn] Unable to find "xcodebuild". Skipping xcodebuild clean step...
✔ Updating iOS native dependencies with pod install in 8.48ms
✔ update ios in 26.63ms
✔ copy web in 6.96ms
✔ update web in 661.19μs
[info] Sync finished in 0.194s
[?] Would you like to help improve Capacitor by sharing anonymous usage data? 💖
    Read more about what is being collected and why here: https://capacitorjs.com/telemetry. You can change your mind at
    any time by using the npx cap telemetry command.
✔ Share anonymous usage data? … yes

Thank you for helping to make Capacitor better! 💖
Information about the data we collect is available on our website: https://capacitorjs.com/telemetry

Но теперь при запуске npm run dev я получаю ошибку Error: Text content does not match server-rendered HTML.

Если я обновлю некст до последней версии я получаю эту ошибку:

Error: Text content does not match server-rendered HTML.

See more info here: https://nextjs.org/docs/messages/react-hydration-error

Кстати, самая первая ошибка в консоли браузера:

Warning: Text content did not match. Server: "0" Client: "362"

Информация от некста по поводу этой ошибки - https://nextjs.org/docs/messages/react-hydration-error index.tsx в sdk - https://github.com/deep-foundation/sdk/blob/86b7abb148e9f504d7e7187726acf0a26de04327/pages/index.tsx#L30-L33

Как бы вы решили эту проблему? Так же, как сказано в доке - делали бы изменение текста в юз эффекте?