Cannot find module '\current\index.js'

  • How was Ghost installed and configured?
    Using local installation through the CLI

  • What errors or information do you see in the console?

Debug Information:
    OS: Microsoft Windows 11 Home Single Language, v10.0.22621
    Node Version: v16.13.0
    Ghost Version: 5.25.2
    Ghost-CLI Version: 1.23.1
    Environment: development
    Command: 'ghost start'
Message: 
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'D:\Programming\WebApps\roundtable-cms\current\index.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Stack: Error: 
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'D:\Programming\WebApps\roundtable-cms\current\index.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

    at ChildProcess.<anonymous> (C:\Users\User\AppData\Roaming\nvm\v16.13.0\node_modules\ghost-cli\lib\utils\local-process.js:65:35)
    at ChildProcess.emit (node:events:390:28)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
  • What steps could someone else take to reproduce your issue?
    I’m unsure what went wrong, it was working all along until I started installing tailwindcss into my theme (probably not directly correlated) But as far as I can tell the “current” folder shortcut does not send me anywhere now. I suspect the “current” folder has been deleted?.. And if so how can i get it back?

I’m quite surprised more people don’t get this issue: I’ve discovered that this happens when the directory that Ghost is in is renamed. The issue primarily comes from the symlink current that points to a subdirectory under version/ which becomes erroneous when the directory name is changed.

There are two ways I’ve been able to solve this issue. One, you could revert the folder name change. Or if you want the directory name change to be reflected by ghost, make a new symlink that points to the correct subdirectory under versions/ and in your config.development.json file change the database.client.connection.filename key and paths.contentPath. :slightly_smiling_face:

Hi @Rickaym,

Thank you for bringing this up, in fact I met this issue when using GitHub to store the source code of the Ghost blog and use multiple computers to write blogs, I also noticed the configs in the config.development.json and tried to update it with the path on the computer that I can using or using relative path, same error exists. Did you change anything else?

{
  "url": "http://localhost:2370/",
  "server": {
    "port": 2370,
    "host": "127.0.0.1"
  },
  "database": {
    "client": "sqlite3",
    "connection": {
      "filename": "current/data/ghost-local.db"
    }
  },
  "mail": {
    "transport": "Direct"
  },
  "logging": {
    "transports": [
      "file",
      "stdout"
    ]
  },
  "process": "local",
  "paths": {
    "contentPath": "current/"
  }
}

I finally turn to Docker with stateful containers.