It looks like you don't have any Field Modules installed

Hi @henry, typically for module development I don’t install the module on the local farmOS server. Instead, I use a separate development environment, provided by field-scripts develop-module, that mocks the process of loading the module’s script file itself, but still connects to the local farmOS server to authenticate (and on that note, just leave the “Host” field blank at login) and to fetch and send data over the API. That way I get the benefits of module reloading (HMR) and all that good stuff. One of these days it’d be great to work out a way to do HMR w/ modules actually live on the local farmOS server, but that’s some extra finesse I haven’t had time to figure out.

So for the Tasks field module, I include these npm scripts in its package.json:

{
  "name": "field-module-tasks",
  // ...
  "scripts": {
    "start": "npm run dev",
    "dev": "field-scripts develop-module",
    "build": "field-scripts build-module --config module.config.js",
    "preview": "vite preview",
    "test": "echo \"Error: no test specified\" && exit 1"
  },
// ...
}

To just test that field module scripts can load properly from the local farmOS server, you can install the test script (although I don’t have it installed regularly, as you can see below):

The process would be the same for loading a test build of the module you’re developing, which can be created with the field-scripts build-module, as you can see in the Tasks module’s package.json above. Then you would just need to upzip the build artifact into your local farmOS file directory and install it from http://127.0.0.1/admin/modules (oh, and I also tend to use 127.0.0.1 for viewing my local farmOS server in the browser just so it doesn’t mess w/ the authentication process for my Field Kit dev environment, which I view at localhost:8080; again, some extra finesse w/ my hosts files or whatever could eliminate the need for all that, but it’s just easier right now to view them from different addresses).

If you’d like to walk through the process together I’d be happy to schedule a chat, probably separate from the weekly dev call b/c it can be tricky for me to make those, but we could use the dev call Jitsit room and leave it open for others to join, possibly record it too.

2 Likes