Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deploying Strapi to Plesk - strapi not found

I want to deploy strapi to a server managed with plesk. I installed strapi in cli. Strapi itself also runs there but says that i should visit localhost:1337/admin

In Plesk a startup-file is needed. Strapi suggests a server.js with 2 lines of code in it

const strapi = require('strapi');

strapi(/* {...} */).start();

however, i exactly this. When i hit the NPM install button it also resolves everything without any problem. If i want to reach my site i get a error from Phusion Passenger

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'strapi'
Require stack:
- /var/www/vhosts/frosty-goldstine.82-165-106-228.plesk.page/strapi/server.js
- /usr/share/passenger/helper-scripts/node-loader.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 Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/var/www/vhosts/frosty-goldstine.82-165-106-228.plesk.page/strapi/server.js:1:16)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/var/www/vhosts/frosty-goldstine.82-165-106-228.plesk.page/strapi/server.js',
    '/usr/share/passenger/helper-scripts/node-loader.js'
  ]
}

How is it possible, that strapi is unknown? And how can i resolve?

like image 772
Tom Avatar asked Oct 15 '25 06:10

Tom


1 Answers

Just need to call the good node_module @strapi/strapi instead of strapi

  • Ubuntu 20.04.4 LTS
  • Plesk Obsidian
  • Strapi 4.1.9
  • npm 6.14.17
  • node 14.19.3
const strapi = require('@strapi/strapi');
strapi().start();
like image 67
jsg Avatar answered Oct 17 '25 20:10

jsg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!