LemmyNet / lemmy-ui

The official web app for lemmy.
https://join-lemmy.org/
GNU Affero General Public License v3.0
880 stars 335 forks source link

Setup development environment for lemmy and lemmy-ui, (node:709) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'site' of null #289

Closed Jieiku closed 3 years ago

Jieiku commented 3 years ago

I am running Ubuntu 20.04.2 LTS I followed the Local Development guide: https://join.lemmy.ml/docs/en/contributing/local_development.html

The lemmy server appears to be trouble free:

root@Web~/lemmy# cargo run
    Finished dev [unoptimized] target(s) in 0.39s
     Running `target/debug/lemmy_server`
Starting http server at 0.0.0.0:8536

The lemmy-ui however I have ran into a problem:

root@Web:~/lemmy-ui# yarn
yarn install v1.22.5
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning "inferno-helmet > inferno-side-effect@1.1.5" has incorrect peer dependency "inferno@^5.0.3".
warning " > inferno-router@7.4.8" has unmet peer dependency "history@^4.10.1".
warning " > inferno-router@7.4.8" has unmet peer dependency "path-to-regexp-es6@1.7.0".
warning " > bootstrap@4.6.0" has unmet peer dependency "jquery@1.9.1 - 3".
warning " > bootstrap@4.6.0" has unmet peer dependency "popper.js@^1.16.1".
warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has incorrect peer dependency "webpack@^4.0.0".
warning ansicolors@0.3.2: Invalid bin field for "ansicolors".
warning ansistyles@0.1.3: Invalid bin field for "ansistyles".
warning archy@1.0.0: Invalid bin field for "archy".
warning call-limit@1.1.0: Invalid bin field for "call-limit".
warning chownr@1.0.1: Invalid bin field for "chownr".
warning cmd-shim@2.0.2: Invalid bin field for "cmd-shim".
warning columnify@1.5.4: Invalid bin field for "columnify".
warning config-chain@1.1.11: Invalid bin field for "config-chain".
warning debuglog@1.0.1: Invalid bin field for "debuglog".
warning detect-indent@5.0.0: Invalid bin field for "detect-indent".
warning dezalgo@1.0.3: Invalid bin field for "dezalgo".
warning editor@1.0.0: Invalid bin field for "editor".
warning fs-vacuum@1.2.10: Invalid bin field for "fs-vacuum".
warning fs-write-stream-atomic@1.0.10: Invalid bin field for "fs-write-stream-atomic".
warning graceful-fs@4.1.11: Invalid bin field for "graceful-fs".
warning has-unicode@2.0.1: Invalid bin field for "has-unicode".
warning iferr@0.1.5: Invalid bin field for "iferr".
warning imurmurhash@0.1.4: Invalid bin field for "imurmurhash".
warning inflight@1.0.6: Invalid bin field for "inflight".
warning inherits@2.0.3: Invalid bin field for "inherits".
warning lazy-property@1.0.0: Invalid bin field for "lazy-property".
warning lodash._baseindexof@3.1.0: Invalid bin field for "lodash._baseindexof".
warning lodash._baseuniq@4.6.0: Invalid bin field for "lodash._baseuniq".
warning lodash._bindcallback@3.0.1: Invalid bin field for "lodash._bindcallback".
warning lodash._cacheindexof@3.0.2: Invalid bin field for "lodash._cacheindexof".
warning lodash._createcache@3.1.2: Invalid bin field for "lodash._createcache".
warning lodash._getnative@3.9.1: Invalid bin field for "lodash._getnative".
warning lodash.clonedeep@4.5.0: Invalid bin field for "lodash.clonedeep".
warning lodash.restparam@3.6.1: Invalid bin field for "lodash.restparam".
warning lodash.union@4.6.0: Invalid bin field for "lodash.union".
warning lodash.uniq@4.5.0: Invalid bin field for "lodash.uniq".
warning lodash.without@4.4.0: Invalid bin field for "lodash.without".
warning npm-cache-filename@1.0.2: Invalid bin field for "npm-cache-filename".
warning npm-install-checks@3.0.0: Invalid bin field for "npm-install-checks".
warning once@1.4.0: Invalid bin field for "once".
warning path-is-inside@1.0.2: Invalid bin field for "path-is-inside".
warning promise-inflight@1.0.1: Invalid bin field for "promise-inflight".
warning read@1.0.7: Invalid bin field for "read".
warning read-cmd-shim@1.0.1: Invalid bin field for "read-cmd-shim".
warning read-installed@4.0.3: Invalid bin field for "read-installed".
warning readdir-scoped-modules@1.0.2: Invalid bin field for "readdir-scoped-modules".
warning sha@2.0.1: Invalid bin field for "sha".
warning slide@1.1.6: Invalid bin field for "slide".
warning sorted-object@2.0.1: Invalid bin field for "sorted-object".
warning sorted-union-stream@2.1.3: Invalid bin field for "sorted-union-stream".
warning text-table@0.2.0: Invalid bin field for "text-table".
warning uid-number@0.0.6: Invalid bin field for "uid-number".
warning umask@1.1.0: Invalid bin field for "umask".
warning unique-filename@1.1.0: Invalid bin field for "unique-filename".
warning unpipe@1.0.0: Invalid bin field for "unpipe".
warning validate-npm-package-name@3.0.0: Invalid bin field for "validate-npm-package-name".
warning wrappy@1.0.2: Invalid bin field for "wrappy".
[5/5] Building fresh packages...
Done in 46.18s.
root@Web:~/lemmy-ui# yarn dev
yarn run v1.22.5
$ yarn start
$ yarn build:dev --watch
$ yarn clean && node generate_translations.js
$ yarn run rimraf dist
$ /root/lemmy-ui/node_modules/.bin/rimraf dist
$ webpack --mode=development --watch
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist@latest --update-db

Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
[RunNodeWebpackPlugin] Starting node script: js/server.js
Inferno is in development mode.
[RunNodeWebpackPlugin] Restarting node script: js/server.js
assets by status 2.23 MiB [cached] 31 assets
assets by status 1.32 MiB [emitted]
  asset js/server.js 1.3 MiB [emitted] [big] (name: main)
  asset styles/styles.css 16.8 KiB [emitted] (name: main)
Entrypoint main [big] 1.32 MiB = styles/styles.css 16.8 KiB js/server.js 1.3 MiB
cached modules 921 KiB (javascript) 16.5 KiB (css/mini-extract) 937 bytes (runtime) [cached] 170 modules
webpack 5.35.1 compiled successfully in 174 ms

assets by path assets/css/ 2.14 MiB
  assets by path assets/css/themes/*.css 2.11 MiB 13 assets
  assets by path assets/css/themes/*.scss 29.1 KiB
    asset assets/css/themes/_variables.bootstra_386-tmp.scss 22.3 KiB [compared for emit] [from: src/assets/css/themes/_variables.bootstra_386-tmp.scss] [copied]
    asset assets/css/themes/_variables.darkly.scss 3.14 KiB [compared for emit] [from: src/assets/css/themes/_variables.darkly.scss] [copied]
    asset assets/css/themes/_variables.i386.scss 1.07 KiB [compared for emit] [from: src/assets/css/themes/_variables.i386.scss] [copied]
    asset assets/css/themes/_variables.vaporwave-dark.scss 1.01 KiB [compared for emit] [from: src/assets/css/themes/_variables.vaporwave-dark.scss] [copied]
    asset assets/css/themes/_variables.litely.scss 952 bytes [compared for emit] [from: src/assets/css/themes/_variables.litely.scss] [copied]
    asset assets/css/themes/_variables.vaporwave-light.scss 661 bytes [compared for emit] [from: src/assets/css/themes/_variables.vaporwave-light.scss] [copied]
  asset assets/css/main.css 5.04 KiB [compared for emit] [from: src/assets/css/main.css] [copied]
assets by path assets/icons/ 89.5 KiB 10 assets
assets by status 3.63 MiB [emitted]
  asset js/client.js 3.61 MiB [emitted] [big] (name: main)
  asset styles/styles.css 16.8 KiB [emitted] [compared for emit] (name: main)
asset assets/manifest.webmanifest 1.09 KiB [compared for emit] [from: src/assets/manifest.webmanifest] [copied]
Entrypoint main [big] 3.63 MiB = styles/styles.css 16.8 KiB js/client.js 3.61 MiB
orphan modules 255 KiB [orphan] 151 modules
runtime modules 1.25 KiB 6 modules
modules by path ./node_modules/ 1.98 MiB (javascript) 3.32 KiB (css/mini-extract)
  cacheable modules 1.98 MiB 389 modules
  css modules 3.32 KiB
    css ./node_modules/css-loader/dist/cjs.js!./node_modules/tributejs/dist/tribute.css 581 bytes [code generated]
    css ./node_modules/css-loader/dist/cjs.js!./node_modules/toastify-js/src/toastify.css 1.4 KiB [code generated]
    css ./node_modules/css-loader/dist/cjs.js!./node_modules/tippy.js/dist/tippy.css 1.36 KiB [code generated]
  ./node_modules/moment/locale/ sync ^\.\/.*$ 3.21 KiB [optional] [built] [code generated]
modules by path ./src/ 912 KiB (javascript) 13.1 KiB (css/mini-extract)
  cacheable modules 912 KiB 95 modules
  css modules 13.1 KiB
    css ./node_modules/css-loader/dist/cjs.js!./src/assets/css/main.css 5.04 KiB [code generated]
    css ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/shared/components/styles.scss 8.11 KiB [code generated]
webpack 5.35.1 compiled successfully in 20663 ms
Inferno is in development mode.
Inferno is in development mode.
Inferno is in development mode.
httpbase: http://localhost:8536
wsUri: ws://localhost:8536/api/v3/ws
No JWT cookie found.
http://0.0.0.0:1234
assets by status 2.23 MiB [cached] 31 assets
assets by status 3.63 MiB [emitted]
  asset js/client.js 3.61 MiB [emitted] [big] (name: main)
  asset styles/styles.css 16.8 KiB [emitted] (name: main)
Entrypoint main [big] 3.63 MiB = styles/styles.css 16.8 KiB js/client.js 3.61 MiB
cached modules 3.12 MiB (javascript) 16.5 KiB (css/mini-extract) 1.25 KiB (runtime) [cached] 684 modules
webpack 5.35.1 compiled successfully in 450 ms
(node:709) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'site' of null
    at Navbar.get (webpack://lemmy-ui/./src/shared/components/navbar.tsx?:426:53)
    at Navbar.navbar (webpack://lemmy-ui/./src/shared/components/navbar.tsx?:205:18)
    at Navbar.render (webpack://lemmy-ui/./src/shared/components/navbar.tsx?:154:17)
    at renderVNodeToString (/root/lemmy-ui/node_modules/inferno-server/dist/index.cjs.js:210:41)
    at renderVNodeToString (/root/lemmy-ui/node_modules/inferno-server/dist/index.cjs.js:307:39)
    at renderVNodeToString (/root/lemmy-ui/node_modules/inferno-server/dist/index.cjs.js:221:20)
    at renderVNodeToString (/root/lemmy-ui/node_modules/inferno-server/dist/index.cjs.js:337:37)
    at renderVNodeToString (/root/lemmy-ui/node_modules/inferno-server/dist/index.cjs.js:221:20)
    at renderVNodeToString (/root/lemmy-ui/node_modules/inferno-server/dist/index.cjs.js:221:20)
    at renderVNodeToString (/root/lemmy-ui/node_modules/inferno-server/dist/index.cjs.js:221:20)
(node:709) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:709) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I filled this under question instead of Bug because its more likely related to my build environment. I am still actively researching these errors to hopefully find a solution myself, so far I have spent about 2 hours trying to figure it out. If I figure out the solution to fixing these errors I will be sure to follow up and close this issue.

Any help is really appreciated.

dessalines commented 3 years ago

I may have introduced a bug on setup somewhere, I'll test that out

dessalines commented 3 years ago

Sorry about that, I found the bug, I introduced it a day or two ago. Re-pull main and you should be good.

Jieiku commented 3 years ago

That did the trick :) I am up and running now:

2021-05-05_15-39