# Shopify CLI error when calling "npm run dev"

**URL:** <https://community.shopify.com/t/shopify-cli-error-when-calling-npm-run-dev/359333>\
**Category:** Shopify Apps\
**Tags:** third-party-apps\
**Created:** [September 18, 2024, 3:19pm UTC](https://community.shopify.com/t/shopify-cli-error-when-calling-npm-run-dev/359333 "2024-09-18T15:19:34Z")\
**Posts on this page:** 4\
**Page:** 1

## AI-generated summary

Issue: Running “npm run dev” for a Shopify app fails with an error about reading an undefined “output” property, likely tied to build tooling or dependency issues.

Current state: Deleting node_modules in root, /web, and /web/frontend did not resolve it. The app previously worked; after attempting an update and then rolling back, the error persists. The developer prefers keeping a local Shopify CLI (per docs) rather than switching to a global install.

Suggested troubleshooting:
- Check webpack.config.js or vite.config.js for invalid “output” references or undefined variables.
- Review and align dependencies; run “npm ls” to spot version conflicts (e.g., react, react-dom, webpack) with the Shopify CLI version.
- Clear build caches and artifacts (Vite’s .vite, Webpack cache, dist/build).
- Verify environment variables across .env files.
- Inspect the stack trace with verbose logging to pinpoint the failing module/file.
- Create a minimal app via the local CLI and compare configurations.

Outcome: No resolution yet. Next step is reviewing config files; switching to a global CLI remains a fallback option. Discussion remains open.

<div class="post-metadata">

**Author:** ![Mat\_Brummitt](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/mat_brummitt/32/52704_2.png) [@Mat\_Brummitt](https://community.shopify.com/u/Mat_Brummitt)\
**Post date:** [September 18, 2024, 3:19pm UTC](https://community.shopify.com/t/shopify-cli-error-when-calling-npm-run-dev/359333/1 "2024-09-18T15:19:34Z")

</div>

My apologies, I just realised I posted this to the wrong board. I’ve reposted in the correct one, but can’t see an option to delete this post, so i’m editing it.

Many thanks

Mat

---

<div class="post-metadata">

**Author:** ![Punlord\_LLC](https://avatars.discourse-cdn.com/v4/letter/p/c67d28/32.png) [@Punlord\_LLC](https://community.shopify.com/u/Punlord_LLC)\
**Post date:** [September 18, 2024, 3:46pm UTC](https://community.shopify.com/t/shopify-cli-error-when-calling-npm-run-dev/359333/2 "2024-09-18T15:46:53Z")

</div>

Hi Mat,

It looks like the error is due to trying to read an undefined ‘output’ property. Here are the top three likely causes:

1. **Dependency Mismatch** : Version conflicts after updating Shopify CLI and other dependencies. Try deleting node\_modules and reinstalling them. I am going to point to your node modules being they are listed several times.

2. **Configuration File Issues** : Check your webpack.config.js or vite.config.js for any incorrect or outdated settings.

3. **Local vs. Global CLI Installation** : Uninstall the local Shopify CLI and reinstall it globally to prevent conflicts.

Let me know how it goes!

Best regards,  
Marc

---

<div class="post-metadata">

**Author:** ![Mat\_Brummitt](https://yyz1.discourse-cdn.com/shopifyforum/user_avatar/community.shopify.com/mat_brummitt/32/52704_2.png) [@Mat\_Brummitt](https://community.shopify.com/u/Mat_Brummitt)\
**Post date:** [September 18, 2024, 3:51pm UTC](https://community.shopify.com/t/shopify-cli-error-when-calling-npm-run-dev/359333/3 "2024-09-18T15:51:29Z")

</div>

Thanks for your response.

I did already try deleting node\_modules in all 3 locations (root, /web and /web/frontend to no avail).

I checked the Shopify docs and although global installation is now the recommendation, there’s a section all about how to have a local installation instead and why you might do this, so I think it should be ok to have it local - it always worked until I tried to update, but then I rolled back and I get the same error.

I will check webpack.config.js and/or vite.config.js as you suggested before running a global install as I’d prefer to keep a local installation if possible.

Many thanks

Mat

---

<div class="post-metadata">

**Author:** ![Punlord\_LLC](https://avatars.discourse-cdn.com/v4/letter/p/c67d28/32.png) [@Punlord\_LLC](https://community.shopify.com/u/Punlord_LLC)\
**Post date:** [September 18, 2024, 3:58pm UTC](https://community.shopify.com/t/shopify-cli-error-when-calling-npm-run-dev/359333/4 "2024-09-18T15:58:38Z")

</div>

Hi Mat,

I understand your preference to keep the CLI locally installed.

Since reinstalling node\_modules didn’t help, here are some further steps to consider:

1. **Inspect Configuration Files**  
Double-check webpack.config.js or vite.config.js for any references to output. Ensure all variables and objects are defined correctly, especially if you’ve updated dependencies recently.

2. **Review Dependencies**  
Run npm ls to inspect the dependency tree and look for any version conflicts or missing packages that might be causing issues. It’s worth aligning critical packages like react, react-dom, or webpack to ensure they’re compatible with your Shopify CLI version.

3. **Clear Caches**  
Try clearing any build caches (e.g., Vite’s .vite directory or Webpack’s cache) and remove old build artifacts (dist, build, etc.). This will force a clean build and eliminate potential conflicts.

4. **Verify Environment Variables**  
Double-check your .env files to ensure all variables are correctly set and consistent across environments. An undefined environment variable could cause this error during build or runtime.

5. **Stack Trace Examination**  
The stack trace might point to specific files or modules. Enable verbose logging in your build process to get more detailed insights into where the issue might lie.

6. **Minimal Reproduction**  
As a last step, you could create a minimal app using the local Shopify CLI (shopify app create node) and compare its configuration files to spot any discrepancies.

Best regards,  
Marc
