Netlify CMS CLI - goes straight to production (SOLVED)

Suspect I’m not understanding the point of Netlify CMS CLI.

I was hoping to use in my development environment to test additions to my Admin pages.
Eg. I want to add new categories, write some test posts using that Admin tool.
But not have them appear on my live site.

So I ran netlify dev on my local development environment.

I then opened localhost:8080/admin.
Issues I noticed:

  1. My blog pages weren’t appearing.
    These were created in the live CMS.

  2. I created a test blog post.
    It appeared on the live site!

So I’m wondering, is the CLI the tool to do what I’m trying to do?

Thanks in advance for any advice.

Netlify CMS always works on production data. It stores data in your repo, so, your production website will always have the same data unless you use another repo for testing.

1 Like

I suppose you’re looking for the local_backend feature: Beta Features! | Netlify CMS | Open-Source Content Management System

1 Like

Thanks Tom, I gave that beta feature a go.
This is likely my tough biscuits issue to work through, but just throwing it out in case anyone knows why its not working.

I added local_backend: local to my config.yml.
Then installed the netlify-cms-proxy-server
And it ‘seems’ to run (although not much verbiage, as per below)
Yet it doesn’t seem to generate a site.
When I try to view localhost, it just gives me, Cannot find /

Out of desperation, I tried the custom port suggestion.
So I added an .env file containing PORT=8082.

My config.yml (top of it):

local_backend:
    # when using a custom proxy server port
    url: http://localhost:8082/api/v1
backend:
    name: git-gateway
    branch: prod
media_folder: 'src/assets/images/uploads'
public_folder: '/images/uploads'

My package.json commands:

  "scripts": {
    "debug": "DEBUG=*Error* npx @11ty/eleventy --dryrun",
    "start": "npx gulp && concurrently 'npx gulp watch' 'npx eleventy --serve'",
    "build": "NODE_ENV=production npx gulp && NODE_ENV=production eleventy",
    "dev": "npx netlify-cms-proxy-server"
  },

My server message looks sparse:

> npx netlify-cms-proxy-server
info: Netlify CMS File System Proxy Server configured with /home/chris/projects/french.plus/website
info: Netlify CMS Proxy Server listening on port 8082

There doesn’t seem to be any network traffic related to my site.
Hence, since I’m running eleventy, I wondered if it needed ‘eleventy’ in the package.json file.
Eg. I tried various permuations, such as:
"dev": "npx netlify-cms-proxy-server eleventy"

But no luck.

Anyone have any ideas/suggestions?

You have to run the npx command alongside your development command (like eleventy serve). The npx netlify-cms-proxy-server only fires up a cms git server, it doesn’t take care of your static site gen.

1 Like

Thanks again for the help Tom.

Eventually got it to work with:

"dev": "npx gulp && concurrently 'npx gulp watch' 'npx netlify-cms-proxy-server' 'npx eleventy --serve'"

Which makes sense, in that all I had to add into my original command was 'npx netlify-cms-proxy-server'

Surprisingly it doesn’t seem to take much of a difference in that command to get it to write to the live site.

Anyway, its great to have this going now, cheers again, very much appreciate your kind help as always!