R
Railway•12mo ago
Just Uo

Error: Cannot find module '@napi-rs/canvas-linux-x64-gnu'

Error: Cannot find module '@napi-rs/canvas-linux-x64-gnu' Require stack: - /app/node_modules/@napi-rs/canvas/js-binding.js - /app/node_modules/@napi-rs/canvas/index.js - /app/node_modules/greetify/build/structures/welcomeCard.js - /app/node_modules/greetify/build/index.js
Solution:
In any case try removing package-lock.json and then run npm i so it will regenerate
Jump to solution
22 Replies
Percy
Percy•12mo ago
Project ID: N/A
maddsua
maddsua•12mo ago
It often happens when a packages has binaries in it and your PC runs windows Try removing package-lock.json and installing packages with npm i and not npm ci Other possibility is that you have this package installed globally on your system but it's not listed in dependencies in package.json
Just Uo
Just UoOP•12mo ago
i got this while running on railway
maddsua
maddsua•12mo ago
Yeah, because railway's servers run linux Are you deploying from github?
Just Uo
Just UoOP•12mo ago
yes should i remove package-lock.json from github
Solution
maddsua
maddsua•12mo ago
In any case try removing package-lock.json and then run npm i so it will regenerate
maddsua
maddsua•12mo ago
I wouldn't say that's required, it's just that the current package lock is a bit broken
Just Uo
Just UoOP•12mo ago
i got this
Error: /app/node_modules/canvas/build/Release/canvas.node: invalid ELF header

at Module._extensions..node (node:internal/modules/cjs/loader:1340:18)

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

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

at Module.require (node:internal/modules/cjs/loader:1143:19)

at require (node:internal/modules/cjs/helpers:119:18)

at Object.<anonymous> (/app/node_modules/canvas/lib/bindings.js:3:18)

at Module._compile (node:internal/modules/cjs/loader:1256:14)

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

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

at Module._load (node:internal/modules/cjs/loader:960:12)
Error: /app/node_modules/canvas/build/Release/canvas.node: invalid ELF header

at Module._extensions..node (node:internal/modules/cjs/loader:1340:18)

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

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

at Module.require (node:internal/modules/cjs/loader:1143:19)

at require (node:internal/modules/cjs/helpers:119:18)

at Object.<anonymous> (/app/node_modules/canvas/lib/bindings.js:3:18)

at Module._compile (node:internal/modules/cjs/loader:1256:14)

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

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

at Module._load (node:internal/modules/cjs/loader:960:12)
Just Uo
Just UoOP•12mo ago
after doing this i got new error
No description
maddsua
maddsua•12mo ago
That's not it 🙂 When a package requires binaries to run it will only download the ones that match your system, but it should also leave links to other versions for other systems It seems like your current package lock has some problems with that try regenerating it
Just Uo
Just UoOP•12mo ago
ohk let me regen
maddsua
maddsua•12mo ago
also you may remove node modules while doing that issues like that often happen when deploying from templates (not railway templates specifically)
Just Uo
Just UoOP•12mo ago
ohk ty it worked ty i have a question how i can use json databse on railway
maddsua
maddsua•12mo ago
yeah no problem can u mark my response as a solution? 🙂 You mean a json file as a database or a document-database such as mongodb? if we're talking about a json file, you can attach a volume and put that file on it, this way it will persist between deployments just keep in mind that a single json file is not really scalable
Just Uo
Just UoOP•12mo ago
i have a folder in which i store data as json file
maddsua
maddsua•12mo ago
then you need to mount a volume and store all the data on it it mounts as a regular directory
Just Uo
Just UoOP•12mo ago
wat how
maddsua
maddsua•12mo ago
in linux you can mount a physical device as a folder and railway takes this advantage with volumes
maddsua
maddsua•12mo ago
maddsua
maddsua•12mo ago
just check in your app if it's on local machine or on railway and use a corresponding directory in may be ./data on local and /data on railway for now volumes don't have file explorer so there are two options 1. the app itself does initial upload (and backups when needed) 2. deploy a file explorer template first, upload all the files using it and then reattach the volume to the app
Just Uo
Just UoOP•12mo ago
No description
No description
maddsua
maddsua•12mo ago
no need to commit that folder if it contains any data it will be overridden by the volume Anyway, if you have more question about volumes, please create a new post. I want those sweet help points kekw
Want results from more Discord servers?
Add your server