Ghost-CLI icon indicating copy to clipboard operation
Ghost-CLI copied to clipboard

Node Version Conflict Installing V1

Open 0xAl3xH opened this issue 2 years ago • 8 comments

Summary

Upgrading from old v0.9 version by running ghost install --v1 does not work.

Steps to Reproduce

  1. nvm use 14
  2. npm install -g ghost-cli@latest
  3. mkdir ghostv1; cd ghostv1
  4. ghost install --v1

Run into Ghost v1.26.2 is not compatible with the current Node version. Your node version is 14.19.3, but Ghost v1.26.2 requires ^8.9.0 || ^10.13.0

I then tried running node v10

  1. nvm use 10
  2. npm install -g ghost-cli@latest
  3. ghost install --v1

Run into Error: yargs parser supports a minimum Node.js version of 12.

I expect to be able to install v1 somehow with the latest ghost-cli.

Log file

Love open source? We’re hiring Node.js Engineers to work on Ghost full-time.
https://careers.ghost.org/product-engineer-node-js



✔ Checking system Node.js version - found v14.19.3
✔ Checking logged in user
✔ Checking current folder permissions
✔ Checking system compatibility
✔ Checking for a MySQL installation
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✖ Downloading and installing Ghost v1.26.2
A SystemError occurred.

Message: Ghost v1.26.2 is not compatible with the current Node version. Your node version is 14.19.3, but Ghost v1.26.2 requires ^8.9.0 || ^10.13.0

Debug Information:
    OS: Ubuntu, v16.04.6 LTS
    Node Version: v14.19.3
    Ghost-CLI Version: 1.21.0
    Environment: production
    Command: 'ghost install --v1'

Try running ghost doctor to check your system for known issues.
/home/---/.nvm/versions/node/v10.24.1/lib/node_modules/ghost-cli/node_modules/yargs/node_modules/yargs-parser/build/index.cjs:1013
        throw Error(`yargs parser supports a minimum Node.js version of ${minNodeVersion}. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions`);
        ^

Error: yargs parser supports a minimum Node.js version of 12. Read our version support policy: https://github.com/yargs/yargs-parser#supported-nodejs-versions
    at Object.<anonymous> (/home/---/.nvm/versions/node/v10.24.1/lib/node_modules/ghost-cli/node_modules/yargs/node_modules/yargs-parser/build/index.cjs:1013:15)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/home/---/.nvm/versions/node/v10.24.1/lib/node_modules/ghost-cli/node_modules/yargs/build/index.cjs:1:59793)
    at Module._compile (internal/modules/cjs/loader.js:778:30)

Technical details

This is automatically output by Ghost-CLI if an error occurs, please copy & paste:

  • OS: Ubuntu, v16.04.6 LTS
  • Node Version: v14.19.3/v10.24.1
  • Ghost-CLI Version: 1.21.0
  • Environment: production
  • Command: ghost install --v1

Bug submission checklist

Please fill out this checklist to acknowledge that you followed the requirements to submit a bug report.

  • [ x] Tried to find help in the forum & docs
  • [ x] Checked for existing issues
  • [ x] Attached log file
  • [ x] Provided technical details incl. operating system

0xAl3xH avatar May 28 '22 23:05 0xAl3xH

I'd upgrade your version of Ubuntu from 16.04.

jcgallaher avatar May 28 '22 23:05 jcgallaher

I was able to get around this by using node v10.24.1 and npm install -g [email protected] by trial and error instead of ghost-cli@latest as stated in your official docs https://ghost.org/docs/reinstall/ please make a note of this or update ghost-cli so this circular dependency is avoided. Thanks!

0xAl3xH avatar May 28 '22 23:05 0xAl3xH

I'd upgrade your version of Ubuntu from 16.04.

It seems this is unrelated to the original problem. A machine running a newer OS with the same node/npm packages will run into the same issue.

0xAl3xH avatar May 28 '22 23:05 0xAl3xH

I expect to be able to install v1 somehow with the latest ghost-cli.

I understand the frustration, but unfortunately, this isn't feasible as it would force Ghost CLI to support node versions that are no longer supported.

The Node Versions page has some documentation mapping which versions of Ghost work with which (minimum) versions of the CLI and node. There's also this forum post which contains versions info for Ghost 2.x and 3.x

Gonna go ahead and close this issue as it seems like you found the best way to install an older Ghost version, even if it's not ideal 🙂

vikaspotluri123 avatar May 28 '22 23:05 vikaspotluri123

I understand the frustration, but unfortunately, this isn't feasible as it would force Ghost CLI to support node versions that are no longer supported.

Hmm, I guess it's rather odd to still have a feature like ghost install --v1 present in the latest ghost-cli package if it doesn't work. Maybe it could be replaced with a deprecation warning message when invoked pointing to an earlier version like [email protected] so users can still upgrade to v1 which is prerequisite to upgrading to latest versions.

At the very least, I think some notes should be made on: https://ghost.org/docs/faq/update-0x/ https://ghost.org/docs/reinstall/

Since both of these documentations cite ghost-cli's use case for upgrading 0.x to newer versions.

0xAl3xH avatar May 29 '22 00:05 0xAl3xH

That's a good point... @acburdine I guess we would ideally remove the --v1 flag, but that would require a major. Should the flag be deprecated as @al3x-huang suggested?

On a related thread note, would it be better to have a "universal" option (e.g. ghost install 5.x/5/v5 installs the latest version of v5? This would allow for up-to-date node checks (1.x --> install ghost-cli@xxx and node y or z)

vikaspotluri123 avatar May 29 '22 04:05 vikaspotluri123

We should just rip out the --v1 flag. It stopped working already, so it's not a major change - the major happened accidentally when it broke. I already removed it from ghost update as part of the reworking there.

ghost install 3/4/5 already works :)

ErisDS avatar Jun 01 '22 10:06 ErisDS

@ErisDS makes sense 👍

I've got a WIP ~~PR~~ branch (https://github.com/vikaspotluri123/ghost-cli/tree/no-more-v1) to rip out the v1 handling, here's the behavior when you run ghost install 1 --local:

$ ~/dev/ghost/cli/bin/ghost install 1 --local

# <removed for brevity>
Running in development mode


✔ Checking system Node.js version - found v16.14.0
✔ Checking current folder permissions
✔ Checking memory availability
✔ Checking free space
✔ Checking for latest Ghost version
✔ Setting up install directory
✖ Downloading and installing Ghost v1.26.2
A SystemError occurred.

Message: Ghost v1.26.2 is not compatible with the current Node version. Your node version is 16.14.0, but Ghost v1.26.2 requires ^8.9.0 || ^10.13.0

Debug Information:
    OS: Ubuntu, v20.04.4 LTS
    Node Version: v16.14.0
    Ghost-CLI Version: 1.21.0
    Environment: development
    Command: 'ghost install 1 --local'

Try running ghost doctor to check your system for known issues.

You can always refer to https://ghost.org/docs/ghost-cli/ for troubleshooting.

Switching to node v10.13.0 will still not let you install v1 because the current version of the CLI requires ^12.22.1 || ^14.17.0 || ^16.13.0.

We have a couple of options here if we want to improve the UX:

  1. Suggest the minimum CLI version that's required by the Ghost version (e.g. Ghost v1.26.2 requires CLI ^1.7.0)
    • This data is available in the package.json of the Ghost version
    • Downside is this would be the "worst" version of the CLI that's supported
  2. Have a hardcoded map of Ghost majors + "best" CLI version
    • Downside is for older versions of a major, this might not line up (e.g. 1.0.0 supports only Node v6)
    • This would require manual maintenance every time a node version is removed from the support matrix

IMO 2 is a better option because it handles the most common use case.

vikaspotluri123 avatar Jun 01 '22 21:06 vikaspotluri123

Our bot has automatically marked this issue as stale because there has not been any activity here in some time. The issue will be closed soon if there are no further updates, however we ask that you do not post comments to keep the issue open if you are not actively working on a PR. We keep the issue list minimal so we can keep focus on the most pressing issues. Closed issues can always be reopened if a new contributor is found. Thank you for understanding 🙂

github-actions[bot] avatar Sep 30 '22 15:09 github-actions[bot]