Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error reported importing database from ‘better-sqlite3’ #2141

Closed
4 tasks done
TyxTang opened this issue Sep 27, 2024 · 9 comments
Closed
4 tasks done

Error reported importing database from ‘better-sqlite3’ #2141

TyxTang opened this issue Sep 27, 2024 · 9 comments
Labels
🐛 Bug Something isn't working

Comments

@TyxTang
Copy link

TyxTang commented Sep 27, 2024

Environment

Docker

Version

0.15.4

Describe the problem

Docker containers report an error on startup
But it's working
I'm not sure if there's anything wrong with it that I'm not aware of

Logs

yarn run v1.22.19

$ ts-node ./migrate.ts

(node:29) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.

(Use node --trace-warnings ... to show where the warning was created)

/app/migrate/migrate.ts:4

import Database from 'better-sqlite3';

^^^^^^

SyntaxError: Cannot use import statement outside a module

at internalCompileFunction (node:internal/vm:73:18)

at wrapSafe (node:internal/modules/cjs/loader:1175:20)

at Module._compile (node:internal/modules/cjs/loader:1219:27)

at Module.m._compile (/app/migrate/node_modules/ts-node/src/index.ts:1618:23)

at Module._extensions..js (node:internal/modules/cjs/loader:1309:10)

at Object.require.extensions.<computed> [as .ts] (/app/migrate/node_modules/ts-node/src/index.ts:1621:12)

at Module.load (node:internal/modules/cjs/loader:1113:32)

at Function.Module._load (node:internal/modules/cjs/loader:960:12)

at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)

at phase4 (/app/migrate/node_modules/ts-node/src/bin.ts:649:14)

error Command failed with exit code 1.

info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Starting production server...

Context

No response

Please tick the boxes

  • I confirm that I attached the proper logs
  • I've read the docs
  • I've checked for duplicate issues
  • I've tried to debug myself
@TyxTang TyxTang added the 🐛 Bug Something isn't working label Sep 27, 2024
Copy link

Hi 👋. Thank you for submitting your first issue to Homarr. Please ensure that you've provided all nessesary information. You can use the three dots > Edit button to update your post with additional images and information. Depending on the current volume of requests, the team should get in conact with you shortly.

@SeDemal
Copy link
Collaborator

SeDemal commented Sep 28, 2024

Hi, homarr can work without the mounts properly done, but you may loose some things in if you restart the container.
could you please show us what your config looks like?

@TyxTang
Copy link
Author

TyxTang commented Sep 28, 2024

你好,homarr 可以在没有正确安装的情况下工作,但是如果你重新启动容器,可能会丢失一些内容。 你能向我们展示一下你的配置是什么样的吗?

This is the path where the container will be mounted
image

This is the environment variable for the container
image

The previous version started without this problem.
This error occurs after the update is complete

@SeDemal
Copy link
Collaborator

SeDemal commented Sep 28, 2024

From what version did you update?

On another note, you have a lot of potentially unnecessary environment variables.
You can remove the following since they are not in use anymore:

EDIT_MODE_PASSWORD
PASSWORD

Next, DATABASE_URL should only need to be set if you are using your own custom database. If you are not, do not change it.

And finally, those next ones I am just unsure if they do anything, but they might also be tempering with homarr:

NODE_ENV
NODE_OPTIONS
NODE_VERSION
YARN_VERSION

Make sure that homarr has the right permissions to use the folders you have mounted too.

@TyxTang
Copy link
Author

TyxTang commented Sep 29, 2024

I upgraded from version 0.15.3, which means I pulled the source code for the latest master branch

Sorry, I forgot to mention that I built the project manually
Then I packaged it into a docker image

yarn install
➤ YN0000: ┌ Resolution step
➤ YN0002: │ @mantine/core@npm:6.0.21 [bdc39] doesn't provide @emotion/react (p2634a), requested by @mantine/styles
➤ YN0002: │ @mantine/next@npm:6.0.21 [bdc39] doesn't provide @emotion/react (pf04a7), requested by @mantine/styles
➤ YN0002: │ @mantine/next@npm:6.0.21 [bdc39] doesn't provide @emotion/react (p9d76b), requested by @mantine/ssr
➤ YN0002: │ @mantine/next@npm:6.0.21 [bdc39] doesn't provide @emotion/server (pe0775), requested by @mantine/ssr
➤ YN0002: │ @nivo/annotations@npm:0.83.1 [6a2dc] doesn't provide react-dom (p04e08), requested by @react-spring/web
➤ YN0002: │ @nivo/axes@npm:0.83.1 [6a2dc] doesn't provide react-dom (pd019a), requested by @react-spring/web
➤ YN0002: │ @nivo/core@npm:0.83.1 [6a2dc] doesn't provide react-dom (p896ad), requested by @react-spring/web
➤ YN0002: │ @nivo/core@npm:0.83.1 [a6114] doesn't provide react-dom (p3766b), requested by @react-spring/web
➤ YN0002: │ @nivo/core@npm:0.83.1 [bdc39] doesn't provide react-dom (p478c3), requested by @react-spring/web
➤ YN0002: │ @nivo/core@npm:0.83.1 [da4e9] doesn't provide react-dom (pbc155), requested by @react-spring/web
➤ YN0002: │ @nivo/line@npm:0.83.1 [bdc39] doesn't provide react-dom (p46f9c), requested by @react-spring/web
➤ YN0002: │ @nivo/tooltip@npm:0.83.1 doesn't provide prop-types (p94058), requested by @nivo/core
➤ YN0002: │ @nivo/tooltip@npm:0.83.1 doesn't provide react (p3546e), requested by @react-spring/web
➤ YN0002: │ @nivo/tooltip@npm:0.83.1 doesn't provide react (p5bf6e), requested by @nivo/core
➤ YN0002: │ @nivo/tooltip@npm:0.83.1 doesn't provide react-dom (pf5853), requested by @react-spring/web
➤ YN0002: │ @nivo/voronoi@npm:0.83.1 [6a2dc] doesn't provide prop-types (p20baf), requested by @nivo/core
➤ YN0002: │ @tiptap/starter-kit@npm:2.1.12 doesn't provide @tiptap/pm (p6560d), requested by @tiptap/core
➤ YN0002: │ @tiptap/starter-kit@npm:2.1.12 doesn't provide @tiptap/pm (p1fe9b), requested by @tiptap/extension-code-block
➤ YN0002: │ @tiptap/starter-kit@npm:2.1.12 doesn't provide @tiptap/pm (pda644), requested by @tiptap/extension-dropcursor
➤ YN0002: │ @tiptap/starter-kit@npm:2.1.12 doesn't provide @tiptap/pm (pa1b36), requested by @tiptap/extension-gapcursor
➤ YN0002: │ @tiptap/starter-kit@npm:2.1.12 doesn't provide @tiptap/pm (p6fff9), requested by @tiptap/extension-history
➤ YN0002: │ @tiptap/starter-kit@npm:2.1.12 doesn't provide @tiptap/pm (p85123), requested by @tiptap/extension-horizontal-rule
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (pa4b89), requested by @tiptap/extension-color
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (p4c47b), requested by @tiptap/extension-highlight
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (p0cf40), requested by @tiptap/extension-image
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (p17aca), requested by @tiptap/extension-link
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (pa5ef2), requested by @tiptap/extension-table-cell
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (pc1841), requested by @tiptap/extension-table-header
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (peac23), requested by @tiptap/extension-table-row
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (p58f5e), requested by @tiptap/extension-table
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (pee198), requested by @tiptap/extension-task-item
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (p4353c), requested by @tiptap/extension-task-list
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (paa6b2), requested by @tiptap/extension-text-align
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (p50fe6), requested by @tiptap/extension-text-style
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (p939b8), requested by @tiptap/extension-underline
➤ YN0002: │ homarr@workspace:. doesn't provide @tiptap/core (p3abb8), requested by @tiptap/react
➤ YN0060: │ homarr@workspace:. provides i18next (pd61c8) with version 22.5.1, which doesn't satisfy what next-i18next requests
➤ YN0002: │ homarr@workspace:. doesn't provide prop-types (p44d56), requested by @nivo/core
➤ YN0060: │ homarr@workspace:. provides react-i18next (pfec32) with version 12.3.1, which doesn't satisfy what next-i18next requests
➤ YN0002: │ homarr@workspace:. doesn't provide vite (pbf76b), requested by @vitejs/plugin-react
➤ YN0000: │ Some peer dependencies are incorrectly met; run yarn explain peer-requirements for details, where is the six-letter p-prefixed code
➤ YN0000: └ Completed in 0s 400ms
➤ YN0000: ┌ Fetch step
➤ YN0000: └ Completed in 1s 295ms
➤ YN0000: ┌ Link step
➤ YN0007: │ better-sqlite3@npm:8.7.0 must be built because it never has been before or the last one failed
➤ YN0007: │ esbuild@npm:0.18.20 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js@npm:3.33.2 must be built because it never has been before or the last one failed
➤ YN0007: │ core-js-pure@npm:3.35.0 must be built because it never has been before or the last one failed
➤ YN0007: │ cpu-features@npm:0.0.9 must be built because it never has been before or the last one failed
➤ YN0007: │ es5-ext@npm:0.10.62 must be built because it never has been before or the last one failed
➤ YN0007: │ tree-sitter-json@npm:0.20.1 must be built because it never has been before or the last one failed
➤ YN0007: │ tree-sitter@npm:0.20.4 must be built because it never has been before or the last one failed
➤ YN0007: │ tree-sitter-yaml@npm:0.5.0 must be built because it never has been before or the last one failed
➤ YN0007: │ ssh2@npm:1.14.0 must be built because it never has been before or the last one failed
➤ YN0000: └ Completed in 2m 13s
➤ YN0000: Done with warnings in 2m 15s

I see the error message
better-sqlite3@npm:8.7.0 must be built because it never has been before or the last one failed
It seems to have something to do with generating the above error

Tried both node version:v20.17.0 and node version:v20.2.0 and they don't work.

@SeDemal
Copy link
Collaborator

SeDemal commented Sep 29, 2024

The docker package is already readily available.
Are you implementing some of your own code?
Errors like this is why we don't really recommend building from source.

I think you may need to do 3 possible commands: yarn, yarn install and yarn build

@TyxTang
Copy link
Author

TyxTang commented Sep 29, 2024

The docker package is already readily available. Are you implementing some of your own code? Errors like this is why we don't really recommend building from source.

I think you may need to do 3 possible commands: yarn, yarn install and yarn build

Yes,I switched to a docker image and it doesn't give me any errors, so it's obviously not a native problem with the application.
I'd also like to ask about the version of components like Node.js used for development, I'd like to continue to try this myself!
Thank you very much for your patience!

@SeDemal
Copy link
Collaborator

SeDemal commented Sep 29, 2024

https://github.com/ajnart/homarr/blob/ddde9992c54ddf9c94cbca6e95e9c8a36363121a/Dockerfile

This is our dockerfile. You can see we set the same node options and actually use the same node version (although the slim version only)

Regarding yarn I am unsure, but I personally seem to have v1.22.19 running.

@TyxTang
Copy link
Author

TyxTang commented Sep 29, 2024

Thank a lot.
I'll close.

@TyxTang TyxTang closed this as completed Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Something isn't working
Projects
Status: ✅ Done
Development

No branches or pull requests

2 participants