Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: hugo.createServer is not a function when trying to start Hugo #2

Open
brunogirin opened this issue Apr 27, 2021 · 0 comments

Comments

@brunogirin
Copy link

I'm trying to create a brand new Hugo project with node-hugo and I'm failing at the first hurdle, which is to start the development server. I get the following error:

$ npm start

> [email protected] start
> ./bin/start.js

hello start
/home/bruno/Projects/carbondb/carbondb.gitlab.io/bin/start.js:10
const hugoServerProcess = hugo.createServer()
                               ^

TypeError: hugo.createServer is not a function
    at Object.<anonymous> (/home/bruno/Projects/carbondb/carbondb.gitlab.io/bin/start.js:10:32)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Function.Module._load (node:internal/modules/cjs/loader:828:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47

The full script is:

#!/usr/bin/env node

console.log("hello start");

const Hugo = require('@small-tech/node-hugo')

const hugo = new Hugo()

// Start Hugo server. Returns a ChildProcess instance.
const hugoServerProcess = hugo.createServer()
hugoServerProcess.on('error', (error) => {
  console.log('Hugo server encountered an error', error)
})
hugoServerProcess.stdout.on('data', (data) => {
  console.log(`[Hugo] ${data}`)
})
hugoServerProcess.stderr.on('data', (data) => {
  console.log(`[Hugo] [ERROR] ${data}`)
})
hugoServerProcess.on('close', (code) => {
  console.log('Hugo server process exited with code', code)
})

And the package.json is:

{
  "name": "carbondb.gitlab.io",
  "version": "1.0.0",
  "description": "Documentation and main web resources for the Carbon DB project.",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start": "./bin/start.js"
  },
  "repository": {
    "type": "git",
    "url": "git+ssh://[email protected]/carbondb/carbondb.gitlab.io.git"
  },
  "author": "",
  "license": "ISC",
  "bugs": {
    "url": "https://gitlab.com/carbondb/carbondb.gitlab.io/issues"
  },
  "homepage": "https://gitlab.com/carbondb/carbondb.gitlab.io#readme",
  "dependencies": {
    "@small-tech/node-hugo": "^2.0.0"
  }
}

It may just be a case of updating the README if the function was changed in v2.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant