Unable to run ghost in windows 11

I get error while trying to run ghost on windows 11

My OS version and nodejs:
node --version:v18.17.1
npm --version: 10.2.3
Ghost-CLI version: 1.25.3
OS Name: Microsoft Windows 11 Pro
Version: 10.0.22621 Build 22621

Terminal cmd output:
E:\Software\learning\Ghost\steps\Ghost>yarn dev
yarn run v1.22.19
$ node .github/scripts/dev.js
Running projects: ghost, ts, admin, adminXDeps, adminX
[ts] ‘while’ is not recognized as an internal or external command,
[ts] operable program or batch file.
[adminXDeps] ‘while’ is not recognized as an internal or external command,
[adminXDeps] operable program or batch file.
[ts] while [ 1 ]; do nx watch --projects=ghost/collections,ghost/in-memory-repository,ghost/bookshelf-repository,ghost/mail-events,ghost/model-to-domain-event-interceptor,ghost/post-revisions,ghost/nql-filter-expansions,ghost/post-events,ghost/donations,ghost/recommendations,ghost/email-addresses – nx run $NX_PROJECT_NAME:build:ts; done exited with code 1
→ Sending SIGTERM to other processes…
[adminXDeps] while [ 1 ]; do nx watch --projects=apps/admin-x-design-system,apps/admin-x-framework – nx run $NX_PROJECT_NAME:build --skip-nx-cache; done exited with code 1
→ Sending SIGTERM to other processes…
[adminX] nx run-many --projects=@tryghost/admin-x-demo,@tryghost/admin-x-settings --targets=build && nx run-many --projects=@tryghost/admin-x-demo,@tryghost/admin-x-settings --parallel=49 --targets=dev exited with code 1
→ Sending SIGTERM to other processes…
[admin] nx run ghost-admin:dev --live-reload-base-url=/ghost/ --live-reload-port=4201 exited with code 1
→ Sending SIGTERM to other processes…
[ghost] nx run ghost:dev exited with code 1

Executing dev command failed:

If you’ve recently done a yarn main, dependencies might be out of sync. Try running yarn fix to fix this.
If not, something else went wrong. Please report this to the Ghost team.

Done in 4.49s.

Got this after running yarn fix

“fix”: “yarn cache clean && rm -rf node_modules && yarn”
replaced it with
“fix”: “yarn cache clean && del node_modules && yarn”,
as I am on windows

cmd output :
[4/4] Building fresh packages…
[-/12] ⠈ waiting…
[-/12] ⠈ waiting…
[-/12] ⠈ waiting…
[-/12] ⠁ waiting…
warning Error running install script for optional dependency: "E:\Software\learning\Ghost\steps\Ghost\node_modules\@newrelic\native-metrics: Command failed.
Exit code: 1
Command: node ./lib/pre-build.js install native_metrics
Arguments:
Directory: E:\Software\learning\Ghost\steps\Ghost\node_modules\@newrelic\native-metrics
Output:

Attempting install in native-metrics module. Please note that this is an
OPTIONAL dependency, and any resultant errors in this process will not
affect the general performance of the New Relic agent, but event loop and
garbage collection metrics will not be collected for the Node VMs page.

Download error: No pre-built artifacts for your OS/architecture., falling back to build

C:\Program Files\nodejs\node.exe E:\Software\learning\Ghost\steps\Ghost\node_modules\node-gyp\bin\node-gyp.js clean configure
gyp info it worked if it ends with ok
gyp info using node-gyp@8.4.1
gyp info using node@18.17.1 | win32 | x64
gyp info find Python using Python version 3.11.4 found at "C:\Python311\python.exe"
gyp ERR! find VS
gyp ERR! find VS msvs_version not set from command line or npm config
gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
gyp ERR! find VS checking VS2019 (16.11.33927.289) found at:
gyp ERR! find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools"
gyp ERR! find VS - found "Visual Studio C++ core features"
gyp ERR! find VS - missing any VC++ toolset
gyp ERR! find VS could not find a version of Visual Studio 2017 or newer to use
gyp ERR! find VS looking for Visual Studio 2015
gyp ERR! find VS - not found
gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
gyp ERR! find VS
gyp ERR! find VS **************************************************************
gyp ERR! find VS You need to install the latest version of Visual Studio
gyp ERR! find VS including the "Desktop development with C++" workload.
gyp ERR! find VS For more information consult the documentation at:
gyp ERR! find VS GitHub - nodejs/node-gyp: Node.js native addon build tool
gyp ERR! find VS **************************************************************
gyp ERR! find VS
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Visual Studio installation to use
gyp ERR! stack at VisualStudioFinder.fail (E:\Software\learning\Ghost\steps\Ghost\node_modules\node-gyp\lib\find-visualstudio.js:122:47)
gyp ERR! stack at E:\Software\learning\Ghost\steps\Ghost\node_modules\node-gyp\lib\find-visualstudio.js:75:16
gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (E:\Software\learning\Ghost\steps\Ghost\node_modules\node-gyp\lib\find-visualstudio.js:363:14)
gyp ERR! stack at E:\Software\learning\Ghost\steps\Ghost\node_modules\node-gyp\lib\find-visualstudio.js:71:14
gyp ERR! stack at E:\Software\learning\Ghost\steps\Ghost\node_modules\node-gyp\lib\find-visualstudio.js:384:16
gyp ERR! stack at E:\Software\learning\Ghost\steps\Ghost\node_modules\node-gyp\lib\util.js:54:7
gyp ERR! stack at E:\Software\learning\Ghost\steps\Ghost\node_modules\node-gyp\lib\util.js:33:16
gyp ERR! stack at ChildProcess.exithandler (node:child_process:427:5)
gyp ERR! stack at ChildProcess.emit (node:events:514:28)
gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
gyp ERR! System Windows_NT 10.0.22621
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "E:\\Software\\learning\\Ghost\\steps\\Ghost\\node_modules\\node-gyp\\bin\\node-gyp.js" "clean" "configure"
gyp ERR! cwd E:\Software\learning\Ghost\steps\Ghost\node_modules\@newrelic\native-metrics
gyp ERR! node -v v18.17.1
gyp ERR! node-gyp -v v8.4.1
gyp ERR! not ok
Failed to execute native-metrics install: Command exited with non-zero code: 1

Failed install of this OPTIONAL dependency will not impact the general performance
$ husky install .github/hooks
husky - Git hooks installed
Done in 848.03s.

I got this error too just now

2 Likes

Were you able to resolve it ?

Not yet on my end. Do you have similar issue?

yes I am using windows, I am getting same issue. Right now I am trying wsl2. for running project. If am successful, I let you know brother.

I highly recommend using WSL2 for working with Ghost on windows. While Windows is nominally supported, there are a couple of annoying bugs that make working on Windows less than smooth. Using WSL means you’re working in an environment much more similar to the one Ghost is developed for, and so things tend to work more reliably.

If you’re switching to WSL and have already started setting up on Windows, I recommend uninstalling yarn, node, etc from Windows, and install them directly in WSL instead.

2 Likes

Thanks✌️, I will now definitely work on wsl2