EmaSuriano/gatsby-starter-mate

Error when running yarn setup

Closed this issue · 4 comments

I'm trying to install the new version of the theme (thanks @EmaSuriano for it).

All ok until I run "yarn setup", which runs the script "ts-node ./bin/setup"

Error from terminal: "Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users\user\Documents\GitHub.....\node_modules\inquirer\lib\inquirer.js from C:\Users\user\Documents\GitHub......\bin\setup.ts not supported.
Instead change the require of inquirer.js in C:\Users\user.....\GitHub.....\bin\setup.ts to a dynamic import() which is available in all CommonJS modules.

It seems that import is not supported, I changed it to a "require" statement but it's not working neither. I've tried on SOF and other resources but couldn't find a solution.

Hello @SeaOfDreams , the issue should be fixed with this PR :) #893

Hi @EmaSuriano, thanks for your fix.
I noticed there was still an error when running the setup file.
I had to de-structrure the objects in order to access the IDs, otherwise it was returning [object object] in the .env file.
const {spaceId} = <any> await prompt(PROMPTS.spaceId);
const {deliveryToken} = <any> await prompt(PROMPTS.deliveryToken);
const {managementToken} = <any> await prompt(PROMPTS.managementToken);

Do you want me to open a pull request?
Also, I can suggest some edit to the README in order to better specify some steps to connect to the Contentful space.

PR merged :) Thanks!