• Register
1 vote
694 views

Problem :

I am very new to Ionic, I have recently started working on Ionic but I am facing below error:

Runtime Error Uncaught (in promise): Error: Module build failed: Error: ENOENT: no such file or directory, open '/Users/stewart/Development/ionic/theWhoZoo/src/pages/model/ratingModel.js'

I think the above error is the result of below line of code:

this.ratingModel = new MyRatingModel();

If I remove this line then I do not face above error.

I have already went through other forums and people are saying that they are getting above error due to a case not matching in the imports and also I have checked mine and I can say they do match.

import { MyRatingModel } from '../model/myratingModel';

How can I fix above error need Ionic expert help.

9 6 2
3,980 points

Please log in or register to answer this question.

2 Answers

1 vote

Solution :

I can surely tell you that above error occurred when the component is not found with the app.module settings.You just need to follow below steps to fix your error:

Just right click on the web browser and then select the inspect in this case you should use chrome. After that in your source tab go to localhost:8100 it is the default port for running ionic. Then navigate to src -> pages and then open your corresponding 'model' page. Please note that a name of .ts file and the path must be as same as a name and path of your added import path in the app.module.ts. In your case there isn't model/myratingModel.ts
I hope above fix helps you in Ionic issue.

5 4 2
17,150 points
0 votes

This error usually occurs when your component can not be found with your app.module settings. You just need to follow one of the below solutions to solve your problem.

Solution 1:

Try to delete the /node_modules and package-lock.json and the run the following commands;

npm install

npm run build

npm start

Solution 2:

You have to follow these steps to solve your problem;

  • Right-click on the web browser you are using and select on the inspect like I am using google chrome.
  • In the source tab, navigate to localhost: 8100 that is the default port for running ionic.
  • Go to the Source tab and open the corresponding page, for example, you are using the model.
  • The name of the .ts file and the path must be the same as the name and the path of the added import path in the app.module.ts file.

Note:

Make sure you enter the correct path because the path is case sensitive. For example, maybe the .ts file is RatingModel.

I hope this will help to solve your problem.

11 5 2
3,890 points

Related questions

0 votes
1 answer 78 views
78 views
Problem: I have already cloned my old project and then executed npm install and after that I also run ionic serve But unfortunately I came across below ionic error: [ERROR] @ionic/app-scripts is required for ionic serve to work properly. Looks like @ionic/app-scripts isn't installed in this project. This package is required for ionic serve in ionic/angular 4 projects.
asked Aug 6, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 15 views
15 views
Problem: What is the solution? > Module build failed: error: enoent: no such file or directory.
asked May 7 Junia Phoebe 23k points
1 vote
1 answer 63 views
63 views
Problem : HELP! I need help understanding this error: open failed: ENOENT (No such file or directory) When I try to create a file to save pictures from the camera, it turns out that I can't create the file.
asked Mar 24 Sabbir Hossain 14.6k points
0 votes
1 answer 6 views
6 views
Problem: Who is there to help me solving the error? error: enoent: no such file or directory, open
asked Mar 27 ashik 14.6k points
0 votes
1 answer 5 views
5 views
Problem: I just want to install socket.io to my project which is located on 3.chat folder. But when I run command it shows warnings. And its not created a node_modules directory inside my project folder. How to fix this?
asked 6 days ago Junia Phoebe 23k points
0 votes
1 answer 33 views
33 views
Problem: npm warn saveerror enoent: no such file or directory, open
asked Feb 19 Dan phillip 4.8k points
0 votes
1 answer 8 views
8 views
Problem: Why I got this error: enoent: no such file or directory?
asked Mar 27 ashik 14.6k points
0 votes
1 answer 7 views
7 views
Problem: How to fix the error: enoent: no such file or directory?Somebody please help me out of this.
asked Mar 27 ashik 14.6k points
0 votes
1 answer 39 views
39 views
Problem: Any ideas on what I need to do to fix the error: enoent: no such file or directory, stat?
asked Mar 27 ashik 14.6k points
0 votes
1 answer 53 views
53 views
Problem: I get this error when running a new react native project. There is no error with the default starter code, but if a change even a letter of the starter text, I get this error. error: enoent: no such file or directory, uv_cwd Any help will be appreciated…!
asked Feb 25 Umar Ahmad 4.1k points