Ghost npm module, ContentPath for Storage Adaptors

I’ve got an issue using storage adaptors and ghost ran as an npm module. When I run ghost I get error saying “cant find module”, and its looking for the npm module in my theme directory, rather than in the project root.


Its something to do with the contentPath, but I’m not sure how to fix this. This is my contentpath:

    paths: {
      contentPath: path.join(__dirname, "content")

Hey @graemepaul! Think this github issue and discussion in it could be helpful for your problem :wink: The best way around contentPath issue is using an absolute path for your contentPath config.

Thanks for the replying, absolute path still doesn’t work with the Storage adaptors. I tried to change my absoloute path from

path.join(__dirname, "content") to
contentPath: "/Users/graeme/Sites/helloworld/content/"

Did you try without trailing slash in the end, like: contentPath: "/Users/graeme/Sites/helloworld/content" ?

I tried that aswell, didnt work

Hi @graemepaul did you end up with any kind of solution to this problem?

Hi @naz No i haven’t found a solution, I even created a post of stack overflow to try fix it. Any ideas what i can do?

What’s the error when you are changing the path to absolute (both with and without trailing / )? It’s rather strange the absolute path doesn’t work :thinking:

I get the same error with or without trailing slash

Error: Cannot find module ‘/Users/graeme/Sites/helloworld/node_modules/ghost/core/server/adapters/storage/s3’

@naz any idea how I can get round this?

Hi @graemepaul, sorry this has fallen off my radar :sweat_smile: It’s kind of hard to tell as we no longer actively supporting installing Ghost as an npm module and it’s hard to find time to set things up.

Can you please share more on how are you using ghost module inside your app and how you are passing in the configuration file into Ghost?

Thanks Gargol, that is disappointing. Can the docs be updated to say you are no longer supporting it please. All of the config is passed via the config.*.json file.

Can you recommend what to use instead of using it as a npm module?

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

Think, the best way to use Ghost for local development is through Ghost-CLI tool described here

For production you’d use this setup:

But it all depends on your situation. If you just want a blog instance ready to go that would be probably a Digital Ocean one click install droplet, and if you don’t want to worry about hosting at all would go with Pro Hosting provided by Ghost team.