Error: Cannot find module '@frontity/core'

Description of your issue

I just followed the instruction as per this page frontity .org /deployment page to deploy my build folder onto my own nodejs server. Then when I try to run the build by using:

npx frontity serve

I am getting the following error:

Error: Cannot find module '@frontity/core'

Specific errors you’re getting in the terminal or in the browser’s console

Nodejs server console:

Error: Cannot find module '@frontity/core'
home/lib/node_modules/frontity/dist/src/cli/index.js
home/lib/node_modules/frontity/dist/src/commands/serve.js
home/lib/node_modules/frontity/dist/src/cli/serve.js

A repository with the code of your project:

A deployed version of your site

The URL of your WP REST API

http://jearwebdevelopment.jear2003.webfactional.com/wp/wp-json

Any help would be appreciated

Hi @jear2003

Welcome to the forum. Make sure that you’re running npx frontity serve from the root of the project folder. I suspect that you’re running the command from another folder, though let me know if this is not the case. Also please let me know if this solves the problem.

Hi @jear2003

Did you solve your issue?
I cloned your repo and I was able to deploy your project → https://error-cannot-find-module-frontity-core-2180-254pn0egp.vercel.app/

⬢  error-cannot-find-module-frontity-core-2180  master ⦿ npx vercel --prod
Vercel CLI 19.1.1
? Set up and deploy “~/PROJECTS/2020/FRONTITY/COMMUNITY/JUNE/error-cannot-find-module-frontity-core-2180”? [Y/n] y
? Which scope do you want to deploy to? Frontity Demos
? Link to existing project? [y/N] n
? What’s your project’s name? error-cannot-find-module-frontity-core-2180
? In which directory is your code located? ./
đź”—  Linked to frontity-demos/error-cannot-find-module-frontity-core-2180 (created .vercel and added it to .gitignore)
🔍  Inspect: https://vercel.com/frontity-demos/error-cannot-find-module-frontity-core-2180/254pn0egp [24s]
âś…  Production: https://error-cannot-find-module-frontity-core-2180.vercel.app [copied to clipboard] [2m]

The only error I had to fix from your remote repo was a missing dependency in the package.json that I solved by doing

npm i -S react-markdown

Hi All! I was able to solve the issue, you guys are right, I was running
npx frontity serve
inside the build folder :stuck_out_tongue_closed_eyes: Thanks for your support!

2 Likes

I’m getting a similar error message when I run frontity dev in the root of the project.

Error: Cannot find module '@frontity/core'
Require stack:
- /Users/username/.npm/_npx/55134/lib/node_modules/frontity/dist/src/commands/dev.js
- /Users/username/.npm/_npx/55134/lib/node_modules/frontity/dist/src/cli/dev.js
- /Users/username/.npm/_npx/55134/lib/node_modules/frontity/dist/src/cli/index.js

I also installed @frontity/core but it still shows the same error message.

Any advice?

Thank you!

Hi @misakimichy,

Can you please provide a repo or code-sandbox with your code? This is especially helpful to find solutions of technical issues with specific code