While installing Ghost from source and running 'yarn setup' i am facing problems

When i try to install Ghost from source on windows 11 pro system by running yarn setup i am encountering the following error

D:\Ghost>yarn setup
yarn run v1.22.22
$ yarn && git submodule update --init && NODE_ENV=development node .github/scripts/setup.js
[1/4] Resolving packages…
warning Resolution field “moment@2.24.0” is incompatible with requested version “moment@^2.29.1”
warning Resolution field “@tryghost/errors@1.3.1” is incompatible with requested version “@tryghost/errors@1.2.26”
warning Resolution field “moment@2.24.0” is incompatible with requested version “moment@2.29.1”
warning Resolution field “moment@2.24.0” is incompatible with requested version “moment@2.29.4”
warning Resolution field “moment@2.24.0” is incompatible with requested version “moment@2.29.4”
warning Resolution field “moment-timezone@0.5.23” is incompatible with requested version “moment-timezone@0.5.34”
warning Resolution field “moment@2.24.0” is incompatible with requested version “moment@2.29.4”
warning Resolution field “@tryghost/errors@1.3.1” is incompatible with requested version “@tryghost/errors@1.2.26”
warning Resolution field “moment@2.24.0” is incompatible with requested version “moment@2.29.1”
warning Resolution field “moment@2.24.0” is incompatible with requested version “moment@2.29.3”
warning Resolution field “moment@2.24.0” is incompatible with requested version “moment@^2.27.0”
warning Resolution field “moment-timezone@0.5.23” is incompatible with requested version “moment-timezone@^0.5.31”
warning Resolution field “moment@2.24.0” is incompatible with requested version “moment@2.27.0”
warning Resolution field “@tryghost/logging@2.4.13” is incompatible with requested version “@tryghost/logging@2.4.10”
warning Resolution field “moment-timezone@0.5.23” is incompatible with requested version “moment-timezone@^0.5.33”
warning Resolution field “moment@2.24.0” is incompatible with requested version “moment@^2.29.1”
success Already up-to-date.
$ husky install .github/hooks
husky - Git hooks installed
‘NODE_ENV’ is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1.
info Visit yarn run | Yarn for documentation about this command.

Can anyone help me please?

You’ve used what appears to be normal Bash shell syntax, but it didn’t work:

NODE_ENV=development node .github/scripts/setup.js

That suggests your shell might not be Bash. Check to see what your shell is:

echo $SHELL

This looks like like a Windows shell prompt.

It may help to use something which better emulates a Linux environment on Windows, like Windows WSL2 or Mysys2. https://www.msys2.org

I don’t use Windows and can’t directly help with either. Now, if you wanted to LInux directly on your laptop hardware, I could help with that. :wink:

I second the recommendation for WSL2. I’ve suggested a few times that the docs should really just point Windows users as WSL2. Even if you get all the Ghost dependencies working on Windows (and this is possible - I did it!), you’re going to find poorer documentation and support. Running WSL2 means that nearly everything written about running Ghost on Linux is going to ‘just work’ on your computer.

You’ll also avoid a bug that makes theme development on Windows (without WSL) unworkable, but got closed without getting fixed. I gather it wasn’t a priority, since it only impacts local development running on Windows. (See here: Cannot generate assets (cards, admin-auth, etc) on local windows install · Issue #14278 · TryGhost/Ghost · GitHub)

That bug was the reason I switched to WSL2, and I have no regrets. WSL2 is the best of both worlds. You get to keep your laptop running Windows, which means you can test your site with all the browsers your Windows users use, while simultaneously having a full Linux environment.

Directions:

  1. Install WSL2 with Ubuntu version 22, following these directions: Install Node on macOS, Windows, and Linux (skip past the Windows directions, straight to WSL)
  2. Follow the local install directions for Linux, from within the WSL2 terminal.
1 Like