Yarn setup: error while creating tables

I’m intending on modding Ghost for custom fields, so I’m trying to build from source.

At first yarn setup was failing for me because of a node version conflict with concurrently, so I’m now on Node 14.20.0. Now that I’m on a more updated v14, the setup command seems to be failing in the middle of creating tables. Edit: I also tried: deleting the whole folder, cloning from github, and running yarn setup; and installing Node v16 via nvm and attempting yarn setup.

knex-migrator is version 5.0.3, ember-cli is version 3.24.0. I’m on Mac OS 10.14.

Here’s the relevant error text:

// .. other tables created above this .. 
[2022-08-18 00:54:30] INFO Creating table: members_newsletters
[2022-08-18 00:54:30] INFO Creating table: comments
[2022-08-18 00:54:30] INFO Creating table: comment_likes
[2022-08-18 00:54:30] INFO Creating table: comment_reports
[2022-08-18 00:54:30] INFO Creating table: jobs
[2022-08-18 00:54:30] ERROR Cannot read property 'startsWith' of undefined

Cannot read property 'startsWith' of undefined

{"config":{"transaction":true},"name":"2-create-fixtures.js"}
"Error occurred while executing the following migration: 2-create-fixtures.js"

Error ID:
    300

----------------------------------------

TypeError: Cannot read property 'startsWith' of undefined
    at /Users/thely/Documents/Development/ndc/Ghost/node_modules/knex-migrator/lib/index.js:1032:19
    at Object.<anonymous> (/Users/thely/Documents/Development/ndc/Ghost/ghost/security/lib/password.js:5:26)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.get password [as password] (/Users/thely/Documents/Development/ndc/Ghost/ghost/security/index.js:19:16)
    at hashPassword (/Users/thely/Documents/Development/ndc/Ghost/ghost/core/core/server/models/user.js:273:33)
    at Child.onSaving (/Users/thely/Documents/Development/ndc/Ghost/ghost/core/core/server/models/user.js:277:15)
    at /Users/thely/Documents/Development/ndc/Ghost/node_modules/bookshelf/lib/base/events.js:101:64
    at tryCatcher (/Users/thely/Documents/Development/ndc/Ghost/node_modules/bluebird/js/release/util.js:16:23)
    at Object.gotValue (/Users/thely/Documents/Development/ndc/Ghost/node_modules/bluebird/js/release/reduce.js:166:18)
    at Object.gotAccum (/Users/thely/Documents/Development/ndc/Ghost/node_modules/bluebird/js/release/reduce.js:155:25)
    at Object.tryCatcher (/Users/thely/Documents/Development/ndc/Ghost/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/Users/thely/Documents/Development/ndc/Ghost/node_modules/bluebird/js/release/promise.js:547:31)

Hey @thely :slightly_smiling_face: I just pushed a commit to fix this: Protected against missing NODE_ENV variable · TryGhost/Ghost@ae336f1 · GitHub. Would you mind doing a git pull?

That fixed it, @daniellockyer! As a note, the admin templates don’t load in node v16, but they do in v14.20. There’s an ember warning to that effect, but it’s worth mentioning. If nothing else, I figured I’d leave this comment in case it helps someone else.