System Information
- Strapi Version: 5.1.1
- Operating System: w10
- Database: mysql
- Node Version: 20.17.0
- NPM Version: 10.8.2
- Yarn Version:
Hello,
I’m trying to get my application to work on cPanel, but it’s not working.
Originally, my project was created with the default SQLite database. From what I read, I can easily switch to Strapi 5, depending on whether I’m using Strapi locally or in production.
So, I set up my .env
file (renamed from .env.production
) accordingly:
DATABASE_CLIENT=mysql
DATABASE_HOST=127.0.0.1
DATABASE_PORT=3306
DATABASE_NAME=xxxx
DATABASE_USERNAME=xxxxx
DATABASE_PASSWORD=xxxxx
DATABASE_SSL=false
I built my backend Strapi app locally. Then, I placed the dist
folder, along with the .env
(renamed from .production.env
), package.json
, and server.js
, which looks like this:
const strapi = require("@strapi/strapi");
const app = strapi({ distDir: "./dist" });
app.start();
Next, I uploaded everything to a specific folder where I keep all my apps on the server. After that, I created a Node application with the correct settings.
Finally, I opened the terminal, sourced the environment, and ran npm install
. After a few minutes, I encountered an error related to better-sqlite3
:
npm error code 1
npm error path /home/wyhpxxxx/nodevenv/mes-applications/xxxxxx/20/lib/node_modules/better-sqlite3
npm error command failed
npm error command sh -c prebuild-install || node-gyp rebuild --release
npm error make : on entre dans le répertoire « /home/wyhpxxxx/nodevenv/mes-applications/xxxxxxxxx/20/lib/node_modules/better-sqlite3/build »
npm error TOUCH ba23eeee118cd63e16015df367567cb043fed872.intermediate
npm error ACTION deps_sqlite3_gyp_locate_sqlite3_target_copy_builtin_sqlite3 ba23eeee118cd63e16015df367567cb043fed872.intermediate
... ...
I tried removing it from package.json
because technically, I’m not using it. This resolved the error. However, when I tried running the following command, it didn’t work:
NODE_ENV=production npm run start.
(or simply npm start
). I got this error:
> backend@0.1.0 start
> strapi start
/home/wyhpxxxx/nodevenv/mes-applications/xxxxxx/20/lib/node_modules/undici/lib/dispatcher/client-h1.js:79
return await WebAssembly.instantiate(mod, {
^
RangeError: WebAssembly.instantiate(): Out of memory: Cannot allocate Wasm memory for new instance
at lazyllhttp (/home/wyhpxxxx/nodevenv/mes-applications/xxxxxx/20/lib/node_modules/undici/lib/dispatcher/client-h1.js:79:28)
Node.js v20.17.0
I think i already had this error in the past but it was because i didn’t build locally. Which is not the case here so i don’t know much what is going on.
I tried this command too without success: NODE_OPTIONS=--max-old-space-size=2048 NODE_ENV=production npm start
Any ideas ?