ionic build error: an error occurred when running subprocess ng

Viewed 2910

I am trying to run an existing project to run on my local machine. I have angular and node installed and have now installed ionic. However, running ionic build gives the error:

ng.cmd run app:build The system cannot find the path specified. [ERROR] An error occurred while running subprocess ng.

    ng.cmd run app:build exited with exit code 1.

I have literally researched and tried EVERYTHING.

So now my first question is: if I run: ng run app:build will this do the identical thing to ionic build?

Secondly, when I do try the above ng command (it works perfectly) and I try to run my app (it is inside of an asp.net project), it loads with the following error in the console (have changed filename for demo purposes):

Loading module from “http://localhost:52870/my/url/xxx.js” was blocked because of a disallowed MIME type (“text/html”). Why does this happen? is it linked to the ionic build issue?

Any help would be most appreciated. I have worked hours upon hours on this.

Thanks

2 Answers

I finally found a solution and hope that this helps someone else going through the same thing: The issue was related to the order of paths in the PATHS environment variable. I followed what the second to last commenter(marckassay) did in the this post https://github.com/ionic-team/ionic-cli/issues/3852. In the comment he links to his changes that he made. I followed this and it completely resolved the problem.

This problem is caused because you don't installed all dependencies than you need to development an app in Ionic

To works you need run in your console

npm i @ionic/angular-toolkit@latest

After this you can run your build again

Related