Cannot Install Ghost on Plesk Obsidian with Nods.js

I want to install Ghost CMS for a domain hosted on my plesk server.

Plesk Version: Plesk Obsidian 18.0.40
Plesk Server OS version: Ubuntu 20.04.03 LTS
Node.js version 14.18.2 is configured for the subdomain I want to use
URL: https://ghost.orangekarat.com
Ghost version: 4.32.0
The subdomain is secured by plesk using Let’s Encrypt

Steps I’ve followed (based on this link):

  • I’ve uploaded the ghost zip file for 4.32.0 to the subdomain root directory and extracted all of the files into that directory.
  • I’ve added a file named .npmrc with the line “scripts-prepend-node-path=true” This is also saved in the subdomain root directory.
  • I’ve modified the file /core/shared/config/defaults.json file to point to the domain “https://ghost.orangekarat.com
  • I’ve updated the file /core/shared/config/env/config.production.json with the database type (mariadb), database name: “ghost”, and correct login credentials.

I then enabled Node.js 14.18.2 for https://ghost.orangekarat.com. I specify the document root and application root directories as seen below:

I then click the “NPM Install” button. After a period of waiting on dependencies and such, a message finally appears filled with warnings and a few fatal errors.

And now I am here to ask what, if anything, I can do to successfully complete the install. :grinning: FYI, I’m running ghost just fine on plesk using a docker container, but I’d prefer this method as it preserves the file permissions for the user who owns this subdomain.

Here is the complete list of warnings and errors I received:

npm WARN deprecated mailgun-js@0.22.0: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated bree@6.5.0: bree@7.0.0 drops support for the browser, Node <12.11.0, and removes bthreads entirely. Either upgrade to v7.0.0 or lock your bree version to v6.5.0.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request-promise@4.2.6: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated intl-messageformat-parser@2.1.3: We've written a new parser that's 6x faster and is backwards compatible. Please use @formatjs/icu-messageformat-parser
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
gyp ERR! build error
gyp ERR! stack Error: not found: make
gyp ERR! stack at getNotFoundError (/opt/plesk/node/14/lib/node_modules/npm/node_modules/which/which.js:13:12)
gyp ERR! stack at F (/opt/plesk/node/14/lib/node_modules/npm/node_modules/which/which.js:68:19)
gyp ERR! stack at E (/opt/plesk/node/14/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack at /opt/plesk/node/14/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack at /opt/plesk/node/14/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack at /opt/plesk/node/14/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack at FSReqCallback.oncomplete (fs.js:191:21)
gyp ERR! System Linux 5.4.0-91-generic
gyp ERR! command "/opt/plesk/node/14/bin/node" "/opt/plesk/node/14/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/vhosts/orangekarat.com/ghost.orangekarat.com/node_modules/dtrace-provider
gyp ERR! node -v v14.18.2
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp WARN Using request for node-pre-gyp https download
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

I had a similar issue, switched to Node v12 and it seemed to fix the issue

Yeah. I finally got it to work in Node 14. I did have to make one change to the database fields in the production json. You have to create a specific entry for the “port.”

@FifthRate @smwii
Hey guys, I’m wondering if you can help me.

I was getting the errors when clicking “install npm”
Switching to version node 14 helped mostly eliminate those. Just 1 or 2 warnings remained.

I want to install this as a subdirectory aka mydomain.com/learn/
I haven’t tried doing a regular install yet, maybe I should - I’ve been using How to Install Ghost CMS on Plesk Hosting (fatihbattal.com.tr) as my guide. It helped I figure but I still can’t get it to work.

Do you guys have any thoughts?

I have a feeling that I have my node.js app settings might be incorrect as well.I’ve tried some of the recommendations regarding those but they Any help would be much appreciated!

Hi there! Here are the exact steps I used to get it to work. Fortunately, it’s pretty easy.

  • Upload the latest version of ghost zip file to the domain directory of your choice in Plesk and extract all of the files into that directory (eg domain.com)
  • In that same directory, create a new file named .npmrc and add this single line “scripts-prepend-node-path=true”
  • Modify the file /core/shared/config/defaults.json file to point to the domain you’ve chose (eg https://domain.com)
  • Create a database with the name “ghost” and specify your login credentials.
  • Update the file /core/shared/config/env/config.production.json with a database client of mysql, database name: “ghost”, and correct login credentials. At one time, I specified a mariadb as the client, and that is incorrect. You must specify mysql.

The first few lines of my config.production.json look like this:

{
    "database": {
        "client": "mysql",
        "connection": {
            "host"     : "localhost",
			"port"	   : "3306",
            "user"     : "your_username",
            "password" : "your_password",
            "database" : "ghost"

Once those changes are made, go to the node.js settings. Here are what mine look like:
image
One you have established the proper settings for your domain name, click the NPM install button and wait. You should see no errors, but you may see a few warnings which you can ignore.
Click “restart app” and then attempt to navigate to domain.com/ghost. You may get a page saying you need to reload. Wait a few moments and then reload the page.

@FifthRate Dude i am so grateful for your help and for taking the time with helping me refine some of these things related to the setup! I did 95% of what you wrote above, but there’s some small items that I didn’t do (aka i put mariadb instead of mysql, naming my database “ghost”, etc…)

a quick question before I make some changes-:

  1. Did you have to configure nginx at all? I am seeing on other forums that other people did, but I don’t see a nginx configuration file in the ftp anywhere. Usually it’s located in a folder directory like this “etc/var/www/…” but I don’t see in this plesk cp.

  2. Regarding extracting the ghost.zip file, did you do it in the domain directory? or in the subdirectory?
    i.e. I plan to use the ghost blog mydomain/blog/ do I extract in mydomain, or in the directory mydomain/blog/

" * Modify the file /core/shared/config/defaults.json file to point to the domain you’ve chose (eg https://domain.com)"
Do I list the domain or the domain with the subdirectory?

image

Thanks so much again!

No worries. If you want to use mydomain/blog, then install the app in that directory and unzip the zip file. The “Document root” directory should then be “mydomain/blog/content”. This will be set by node.js as your webroot - all of your content will reside there. Anyone navigating to “mydomain/blog” will be served your home page from that document root directory. The application root simply tells node.js where to find the ghost instance for your blog.

I had to make no changes to the webserver config to get this to to work. No changes necessary to NGINX, assuming you are using the standard Plesk webserver setup.

Hi @FifthRate
I did as instructed and got no luck.

Here’s what I did
Since i’m a new user - need to post the images separately:

downloaded zip version 4.35, uploaded to mydomain/learn/
Unzipped.

created .npmrc in the mydomain.com/learn/

Node.js settings:
image

Edited defaults.json:
image below

Edited: config production json
image below

npm install had 2 warnings, no errors.

Then finally went to:
mydomain.com/learn/ghost

Got an error that “something went wrong.”

Any thoughts where I went wrong

Edited defaults.json:
image

Edited: config production json
image below

Edited: config production json - i did get it to work on a subdomain however!

Hi @FifthRate , I redid the whole process and it worked, one thing to note, I didn’t need to name the database “ghost”

The only issue now is if you go to my homepage (mydomain .com) i get a node.js error:
image

“CANNOT GET /”

which is weird because I defined the the app as existing on the subdirectory. Any thoughts on how to resolve that for the home page?

Thrilled that you got it up and running, but I’m afraid I don’t know the answer here. I can only advise you to look over the logs.

@FifthRate

The issue seems to do with the application url in the node.js settings for plesk, but i don’t know how to change it

image