Hydrogen CLI error after upgrading from 2023.10.4 to 2024.01.0

Hydrogen CLI error after upgrading from 2023.10.4 to 2024.01.0

techroller
Shopify Partner
2 0 2

I am attempting to upgrade Shopify Hydrogen from 2023.10.4 to 2024.01.0 and I am encountering the following error:

 

╭─ error ──────────────────────────────────────────────────────────────────────╮
│                                                                              │
│  config.plugins.map is not a function                                        │
│                                                                              │
│  To investigate the issue, examine this stack trace:                         │
│    at registerCleanBugsnagErrorsFromWithinPlugins (@shopify/cli-hydrogen/no  │
│    de_modules/@shopify/cli-kit/src/public/node/error-handler.ts:170)         │
│      config.plugins.map(async (plugin) => {                                  │
│    at init (@shopify/cli-hydrogen/node_modules/@shopify/cli-kit/src/public/  │
│    node/base-command.ts:40)                                                  │
│      await registerCleanBugsnagErrorsFromWithinPlugins(this.config)          │
│    at async runCLI (@shopify/cli-kit/src/public/node/cli.ts:88)              │
│      await run(undefined, options.moduleURL)                                 │
│    at async runShopifyCLI (@shopify/cli/src/index.ts:42)                     │
│      await runCLI({                                                          │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯

    TypeError: config.plugins.map is not a function

My environment:

Node version: v20.10.0

NPM version: 10.2.3

macOS: Sonoma 14.2.1

 

The steps to reproduce:

1. Make a clean git branch in which to run upgrade

2. issue the following command (`h2` alias is correctly configured)

$ h2 upgrade

- Go through the upgrade steps

- At this point, upgrade appears to be successful. I followed the upgrade `md` file and ensured the appropriate changes were made.

3. Run

$ npm run build
... successful
$ npm run dev
... successful (no problem running local dev server)
$ npm install
... successful, all dependencies up to date

4. In order to clean up old dependencies:

$ rm -rf node_modules
$ rm package-lock.json $ npm install $ npm run build > [... RECACTED app name] build > shopify hydrogen build ╭─ error ──────────────────────────────────────────────────────────────────────╮ │ │ │ config.plugins.map is not a function │ │ │ │ To investigate the issue, examine this stack trace: │ │ at registerCleanBugsnagErrorsFromWithinPlugins (@shopify/cli-hydrogen/no │ │ de_modules/@shopify/cli-kit/src/public/node/error-handler.ts:170) │ │ config.plugins.map(async (plugin) => { │ │ at init (@shopify/cli-hydrogen/node_modules/@shopify/cli-kit/src/public/ │ │ node/base-command.ts:40) │ │ await registerCleanBugsnagErrorsFromWithinPlugins(this.config) │ │ at async runCLI (@shopify/cli-kit/src/public/node/cli.ts:88) │ │ await run(undefined, options.moduleURL) │ │ at async runShopifyCLI (@shopify/cli/src/index.ts:42) │ │ await runCLI({ │ │ │ ╰──────────────────────────────────────────────────────────────────────────────╯ TypeError: config.plugins.map is not a function

I don't understand why, after having upgraded my dependencies, ensuring my package.json file was clean and up-to-date, I would see the error. The error didn't happen until after I deleted my `node_modules` directory and did a `npm install`. I think this method of cleaning out old dependencies is pretty common, albeit a bit heavy handed, but everyone seems to do it.

 

Thanks for your help!

Replies 3 (3)

techroller
Shopify Partner
2 0 2

Alright, I think running

$ npm prune

might have fixed it. I wish I could say for sure but it seems to be working after running prune.

daniel-roster
Shopify Partner
2 0 0

I am also experiencing the same issue. npm prune hasn't worked for me. 

I am trying to deploy our app using

 

shopify app deploy -c shopify.app.toml

 


We are getting the error 

 

╭─ error ──────────────────────────────────────────────────────────────────────╮
│ │
│ config.plugins.map is not a function │
│ │
│ To investigate the issue, examine this stack trace: │
│ at registerCleanBugsnagErrorsFromWithinPlugins │
│ (@shopify/cli-kit/src/public/node/error-handler.ts:170) │
│ config.plugins.map(async (plugin) => { │
│ at init (@shopify/cli-kit/src/public/node/base-command.ts:40) │
│ await registerCleanBugsnagErrorsFromWithinPlugins(this.config) │
│ at async runCLI │
│ (@shopify/cli/node_modules/@shopify/cli-kit/src/public/node/cli.ts:88) │
│ await run(undefined, options.moduleURL) │
│ at async runShopifyCLI (@shopify/cli/src/index.ts:42) │
│ await runCLI({ │
│ │
╰──────────────────────────────────────────────────────────────────────────────╯

 

 

 

Penpen
Visitor
1 0 0

I have the same issue, and i figured out is a problem with @Shopify/cli version 3.54.0 and above. I guess it has to do with the implimentation fo the oclif, but I have no idea how to fix it.

 

I checked all my codes and can't find where I import any config.plugin