Cannot Find Module while creating a shopify app.

Cannot Find Module while creating a shopify app.

arimtiaz
Shopify Partner
11 0 2

I created a shopify app using cli and why am I getting this errorScreenshot 2024-07-04 at 12.23.33 PM.png

Replies 7 (7)

Kyle_liu
Shopify Partner
93 14 15

Hi @arimtiaz 

Can you share your project structure?
Also, what kind of database did you use, sqllite?mysql?mongo? which one? Or other.

If this is helpful, please Like and Accept the solution.
Want to modify or custom changes on store? Let me help.
- Feel free to contact me on (liushuaicc@shinetechsoftware.com)
Mullemaus
Shopify Partner
2 0 0

After following these steps https://shopify.dev/docs/apps/build/scaffold-app i get the same error. The Console gives me further output, that some files like ../app/routes/webhooks.jsx failed to load with the question if the file does exist. But when i browse the project structure all files are present.

shopify cli version 3.63.2

arimtiaz
Shopify Partner
11 0 2

Were you able to solve it?

arimtiaz
Shopify Partner
11 0 2

I used the shopify cli to create the app (remix), I haven't even touched the file and it is showing me this error. As far as I know I dont kneed to connect to a db if i use the shopify cli to create a appScreenshot 2024-07-04 at 12.23.33 PM.png

arimtiaz
Shopify Partner
11 0 2

I just followed the default shopify app creating process using the cli. Here is the file structureScreenshot 2024-07-04 at 10.58.22 PM.png

nminaya
Shopify Partner
2 0 0

I'm getting the same error. 

I tried replacing the character '~' by "." in the following line of file "shopify.server.js":

  import prisma from "./db.server";

Now the error happens in another import, but with the same '~' issue:

nminaya_0-1720123728352.png

 

For some reason the path setting on tsconfig.json is not being recognized

"paths": {
"~/*": ["./app/*"]
},

 

So, the quickly solution is replacing "~" by "." or ".." according to the location of the file. 

It is working for me:

nminaya_1-1720125236527.png

 

Hopefully somebody will post how to solve the issue with tsconfig.json to avoid replacing "~" in every file.

Mullemaus
Shopify Partner
2 0 0

Hello, 

 

thank you for the quick response! The replacement of "~" by "." or ".." worked for me as well.