TypeError on running hs create

I’m facing an issue where I’m trying to create a new template with

hs create template templates/basic-page

This instantly throws me a following error:
A TypeError has occurred. lines.flat is not a function.

It also repeats the syntax of that hs create command, which seems a little different to what is being showcased in the HubSpot Academy course. To confirm this wasn’t just an incorrect syntax however, I also tried to comply with the suggested syntax - got the same error.

Any idea what would be going wrong here? I am successfully running hs watch, so it’s not like the CLI tools would be missing or non-functional.

Hi @Peistola

The error message “A TypeError has occurred. lines.flat is not a function” typically indicates a compatibility issue with the version of Node.js you are using.

To resolve this issue, you can try the following steps:

1. Update Node.js: Ensure that you are using the latest stable version of Node.js. Visit the official Node.js website (https://nodejs.org/) to download and install the latest version.

  1. Clear npm/Yarn cache: Clearing the npm/Yarn cache can help resolve potential conflicts. Run the following command in your terminal to clear the cache:
    - For npm: `npm cache clean --force`
    - For Yarn: `yarn cache clean`

3. Reinstall HubSpot CLI: Reinstalling the HubSpot CLI can also help resolve any potential issues. Uninstall the CLI by running the following command:
- For npm: `npm uninstall -g @hubspot/cli`
- For Yarn: `yarn global remove @hubspot/cli`

Then, reinstall the CLI by running the following command:
- For npm: `npm install -g @hubspot/cli`
- For Yarn: `yarn global add @hubspot/cli`

4. Try the command again: Once you have updated Node.js and reinstalled the HubSpot CLI, attempt to run the `hs create` command again and check if the error persists.

If the issue continues, it may be helpful to provide additional information such as the specific version of Node.js and the HubSpot CLI you are using, as well as any other relevant details about your development environment. This can assist in further troubleshooting the issue.