Visual Editor error Running dev server using: 'undefined '

I have two sites - one of which loads the visual editor fine, and the other refuses, no matter what I do, to load the visual editor.

The editor works fine when running locally… but not when I launch it from Netlify. It keeps crashing.

Here’s the logs for the site with the error - the content-biggerpockets.netlifyapp.com site.

17:18:48:
17:18:48: Starting Stackbit service
17:18:48: ─────────────────────────────────
17:18:48: [info] Container v0.5.0 (common: v1.0.14, core: v3.1.3)
17:18:48: [info] Stackbit service running on node v18.20.4
17:18:48:
17:18:48: Cloning repository
17:18:48: ──────────────────────────
17:18:48: [info] Cloning repository from 'git@github.com:BiggerPockets/content.git'...
17:18:49: [info] Checking out branch 'preview'...
17:18:49: [info] ✅ Done
17:18:49:
17:18:49: Setting up environment
17:18:49: ──────────────────────────────
17:18:49: [info] Container running from /home/appuser/app
17:18:49: [info] nodeVersion in stackbit config is set to '18', switching node version...
17:18:49: [info] Running command '. $NVM_DIR/nvm.sh && nvm alias default 18 && nvm use default && echo "NVM_BIN:$NVM_BIN" ' in /usr/src/app...
17:18:49: [info] switched node version to v18.20.4
17:18:49: [info] ✅ Done
17:18:49:
17:18:49: Installing dependencies
17:18:49: ───────────────────────────────
17:18:49: [info] Installing dependencies using yarn: 'yarn install --non-interactive --cache-folder /home/appuser/.cache-app --color=always'
17:18:49: [debug] [yarn-install]: installing under node version: v18.20.4
17:18:50: [debug] [yarn-install]: yarn install v1.22.22
17:18:50: [debug] [yarn-install]: [1/4] Resolving packages...
17:18:50: [debug] [yarn-install]: [2/4] Fetching packages...
17:18:50: [debug] [yarn-install]: warning Pattern ["strip-ansi@^6.0.1"] is trying to unpack in the same destination "/home/appuser/.cache-app/v6/npm-strip-ansi-cjs-6.0.1-9e26c63d30f53443e9489495b2105d37b67a85d9-integrity/node_modules/strip-ansi-cjs" as pattern ["strip-ansi-cjs@npm:strip-ansi@^6.0.1"]. This could result in non-deterministic behavior, skipping.
17:18:50: [debug] [yarn-install]: warning Pattern ["string-width@^4.1.0"] is trying to unpack in the same destination "/home/appuser/.cache-app/v6/npm-string-width-cjs-4.2.3-269c7117d27b05ad2e536830a8ec895ef9c6d010-integrity/node_modules/string-width-cjs" as pattern ["string-width-cjs@npm:string-width@^4.2.0"]. This could result in non-deterministic behavior, skipping.
17:18:50: [debug] [yarn-install]: warning Pattern ["strip-ansi@^6.0.0"] is trying to unpack in the same destination "/home/appuser/.cache-app/v6/npm-strip-ansi-cjs-6.0.1-9e26c63d30f53443e9489495b2105d37b67a85d9-integrity/node_modules/strip-ansi-cjs" as pattern ["strip-ansi-cjs@npm:strip-ansi@^6.0.1"]. This could result in non-deterministic behavior, skipping.
17:18:53: [debug] [yarn-install]: [3/4] Linking dependencies...
17:18:54: [debug] [yarn-install]: [4/4] Building fresh packages...
17:18:54: [debug] [yarn-install]: Done in 3.91s.
17:18:54:
17:18:54: Running post-install command
17:18:54: ────────────────────────────────────
17:18:54: [info] Running command 'npm i --no-save @stackbit/types ' in /home/appuser/app...
17:18:54: [debug] [postInstallCommand]: (node:847) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.
17:18:54: [debug] [postInstallCommand]: (Use `node --trace-warnings ...` to show where the warning was created)
17:18:56: [debug] [postInstallCommand]: added 4 packages, and audited 205 packages in 2s
17:18:56: [debug] [postInstallCommand]: 54 packages are looking for funding
17:18:56: [debug] [postInstallCommand]: run `npm fund` for details
17:18:56: [debug] [postInstallCommand]: found 0 vulnerabilities
17:18:56: [debug] [postInstallCommand]: npm notice
17:18:56: [debug] [postInstallCommand]: npm notice New minor version of npm available! 10.7.0 -> 10.8.3
17:18:56: [debug] [postInstallCommand]: npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.3
17:18:56: [debug] [postInstallCommand]: npm notice To update run: npm install -g npm@10.8.3
17:18:56: [debug] [postInstallCommand]: npm notice
17:18:56: [info] ℹ️ There is a new container version available.
17:18:56: [info] ✅ Done
17:18:56:
17:18:56: Loading Stackbit config
17:18:56: ───────────────────────────────
17:18:56: [info] Current working directory: .
17:18:56: [info] Loaded config from 'stackbit.config.ts'
17:18:56: [info] ✅ Done
17:18:56:
17:18:56: Loading content
17:18:56: ───────────────────────
17:18:56: [info] Using Content Source Interface
17:18:56: [info] ✅ Done
17:18:56:
17:18:56: Running dev server
17:18:56: ──────────────────────────
17:18:56: [info] Current working directory: .
17:18:56: [info] Running dev server using: 'undefined '...
17:18:56: [info] to configure a different command use `devCommand`
17:18:56: [error] ❌ Service stopping

Here’s my stackbit.config.ts:

import { defineStackbitConfig } from '@stackbit/types';
import { GitContentSource } from '@stackbit/cms-git';
import { Page } from './src/local/models/page';

export default defineStackbitConfig({
    stackbitVersion: '~0.6.0',
    ssgName: 'custom',
    devCommand: './node_modules/.bin/eleventy --serve',
    experimental: {
        ssg: {
            name: 'eleventy',
            logPatterns: {
                up: ['Server at']
            }
        }
    },
    nodeVersion: '18',
    contentSources: [
        new GitContentSource({
            rootPath: __dirname,
            contentDirs: ['src'],
            models: [Page],
            assetsConfig: {
                referenceType: 'static',
                staticDir: 'public',
                uploadDir: 'images',
                publicPath: '/'
            }
        })
    ],
    modelExtensions: [
        { name: 'Page', type: 'page', urlPath: '/{slug}' }
    ]
});

I’ve tried everything I can think of as the devCommand - npx @11ty/eleventy --serve {PORT}, lots of other options.

And yet I still keep getting the same error.

I’ve also removed Visual Editor and re-added it.

I’m using Yarn, I’ve got node 18.

My package.json

{
  "name": "content-eleventy-stackbit",
  "license": "MIT",
  "engines": {
    "node": ">=18"
  },
  "devDependencies": {
    "@11ty/eleventy": "^2.0.1"
  },
  "dependencies": {
    "@stackbit/cli": "^0.3.102",
    "@stackbit/cms-git": "^1.0.10",
    "@stackbit/types": "^2.1.0",
    "global": "^4.4.0"
  }
}

What on earth am I doing wrong please?

Fixed it. Turns out… I was pushing changes to the main branch and not the preview branch! Doh!

That’s why none of my changes were taking effect…

that’s awesome! I’m happy to hear you found your solution!