-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Description
Bug report
Required System information
- Node.js version: 16.15.0
- NPM version: 8.5.5
- Strapi version: 4.1.12
- Database: MySQL
- Operating system: CentOS Plesk
Describe the bug
I am trying to run Strapi on a CentOS Plesk installation. So far I had to do dnf (or yum) install gcc gcc-c++ make in order to get npm install to work. So far, so good. Next problem occurs when I want to run Strapi. I read that I had to create a file, app.js for example, containing the following:
const strapi = require(‘strapi’);
strapi().start();
If I then point Plesk at that file and start (or just run node app.js), I get the following error:
$ node app.js
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'strapi'
Require stack:
- /var/www/vhosts/website.com/public/app.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/var/www/vhosts/website.com/public/app.js:1:16)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/var/www/vhosts/website.com/public/app.js' ]
}
However, I can get Strapi to build and run the application by doing node node_modules/@strapi/strapi/bin/strapi.js, which is kind of hacky, but it works.
Is there a better way?
Steps to reproduce the behavior
- Setup Strapi on a Plesk server
- Try to run
npm run buildor create the JS file listed above
Metadata
Metadata
Assignees
Labels
No labels