Search code examples
node.jsmacosshopifyhomebrewshopify-cli

Unexpected identifier assert Shopify Remix app


I have installed Node.js Shopify CLI and using Homebrew.

When run shopify app dev it provides a local url http://localhost:56467/ . This url giving error below.

Unexpected identifier 'assert'

at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:166:18)
at callTranslator (node:internal/modules/esm/loader:416:14)
at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:422:30

Click outside, press Esc key, or fix the code to dismiss. You can also disable this overlay by setting server.hmr.overlay to false in vite.config.js.

I am using below version software

 node version = v22.0.0

 npm  version = 10.5.1

 Current Shopify CLI version = 3.59.1

 ruby version = ruby 2.6.10p210 (2022-04-12 revision 67958)
[universal.x86_64-darwin21]

 macOS Monterey version 12.7.4

enter image description here


Solution

  • Your Current Shopify CLI version: 3.59.1 is latest and you are also using latest version of node.

    Downgrade your node version

    First check nvm is available or not in your system (nvm -v).

    if not available install nvpm

    Download nvm installation script

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    

    Verify nvm installation

    nvm --version
    

    Check available version of node

    nvm ls
    

    Use nvm to install Node.js 20

    nvm install 20
    

    Use Node.js version 20

    nvm use 20
    

    Run shopify app dev and test your local url