main.ts is missing from de TypeScript compilation
Hello,
I just installed node and tried to use cli. I went with the guide:
`npm install -g @angular/cli
ng new my-project cd my-project ng serve`
aaaaaand.... nope:
ERROR in C:/Users/hpelitebook/Documents/github/angularjs/angular2/src/main.ts
Module build failed: Error: C:\Users\hpelitebook\Documents\github\angularjs\angular2\src\main.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (C:\Users\hpelitebook\Documents\github\angularjs\angular2\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
at plugin.done.then (C:\Users\hpelitebook\Documents\github\angularjs\angular2\node_modules\@ngtools\webpack\src\loader.js:467:39)
at <anonymous>
ERROR in C:/Users/hpelitebook/Documents/github/angularjs/angular2/src/polyfills.ts
Module build failed: Error: C:\Users\hpelitebook\Documents\github\angularjs\angular2\src\polyfills.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (C:\Users\hpelitebook\Documents\github\angularjs\angular2\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
at plugin.done.then (C:\Users\hpelitebook\Documents\github\angularjs\angular2\node_modules\@ngtools\webpack\src\loader.js:467:39)
at <anonymous>
This is my first time with it and i'm not sure where to look
Thank you!
Thank you! That does the trick and the serve command works. But as I try the ng commands while I am at a symlinked path, I get the some warnings. The output of "ng serve" looks like this:
** Angular Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2019-02-28T13:13:36.820Z
Hash: ebdef6caace71813630d
Time: 14555ms
chunk {main} main.js, main.js.map (main) 127 kB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 258 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 745 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 8 MB [initial] [rendered]
WARNING in ./node_modules/@angular/core/fesm5/core.js 18349:15-36
Critical dependency: the request of a dependency is an expression
WARNING in ./node_modules/@angular/core/fesm5/core.js 18361:15-102
Critical dependency: the request of a dependency is an expression
i 「wdm」: Compiled with warnings.
The app seems to work correctly, but because of this warnings I am not sure if really everything works. I know, it's "just" a warning and maybe this is not really relevant because it is only the fesm5 core. But if we could figure out how to prevent this warnings, I would be happy.
To let you have a little bit more informations: OS: win32 x64 Console: git-bash / msys2 Node: 10.13.0 Angular CLI: 7.3.1 Angular: 7.2.5
Do you have any idea why I get this errors?
Editing angular.json to add following attribute under the node "projects/{yourprojectname}/architect/build/options" should help: "preserveSymlinks": true
You make my day guy, many thanks ! :)
Yep, adding ("preserveSymlinks": true) to the angular.json file got rid of the compiling error regarding main.ts
hmm, maybe not the compiler was still active when I was trying to fix another error and now the error regarding main.ts has returned
I faced the same problem during ng serve
but npm start solved my problem as it was showing some error in webpack module
npm start also did the job for me
I faced the same problem during
ng servebutnpm startsolved my problem as it was showing some error in webpack module
Editing angular.json to add following attribute under the node "projects/{yourprojectname}/architect/build/options" should help: "preserveSymlinks": true
You make my day guy, many thanks ! :)
Editing angular.json to add following attribute under the node "projects/{yourprojectname}/architect/build/options" should help: "preserveSymlinks": true
Thanks much. I still have a feeling that something in node_modules is missing. BTW:
- I created the new project from scratch and got the same error and the property entry in package.json fixed it
- Below is my configuration/ version Angular CLI : 8.1.0 Node : 10.16.0 NPM : 6.9.0 Window-10: 64-bit
Had this issue today, caused by being in the project folder through a symlink when running ng serve.
Is there any reason to no have preserveSymlinks as true by default?
Check the path. I found out that my path had spaces such as: '~/My Documents/' That did not work for me. Solution: I put the project somewhere else that had no spaces within the file path.
@jaythomasv29 Looks to me that the issue was the My Documents symlink. You can confirm by putting the project back where it was and adding the preserveSymlinks property to true as suggested here in a comment above
Hello, I also experienced this problem for a while, and I solved it by just changing the location of my project. I put it in the disk other than that of the system (example: d :, e: ...)
Having the same issue:
> yarn build yarn run v1.6.0 $ ng build Date: 2018-05-22T19:52:01.735Z Hash: 7a9bf0b1a9416b4e7f92 Time: 5862ms chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered] chunk {main} main.bundle.js, main.bundle.js.map (main) 929 bytes [initial] [rendered] chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 886 bytes [initial] [rendered] chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 261 kB [initial] [rendered] ERROR in ./src/main.ts Module build failed: Error: /Users/keegomyneego/Documents/Projects/roshub_web_app/src/main.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. at AngularCompilerPlugin.getCompiledFile (/Users/keegomyneego/Documents/Projects/roshub_web_app/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:662:23) at plugin.done.then (/Users/keegomyneego/Documents/Projects/roshub_web_app/node_modules/@ngtools/webpack/src/loader.js:467:39) at <anonymous> at process._tickCallback (internal/process/next_tick.js:188:7) @ multi ./src/main.ts ERROR in ./src/polyfills.ts Module build failed: Error: /Users/keegomyneego/Documents/Projects/roshub_web_app/src/polyfills.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. at AngularCompilerPlugin.getCompiledFile (/Users/keegomyneego/Documents/Projects/roshub_web_app/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:662:23) at plugin.done.then (/Users/keegomyneego/Documents/Projects/roshub_web_app/node_modules/@ngtools/webpack/src/loader.js:467:39) at <anonymous> @ multi ./src/polyfills.ts error Command failed with exit code 1.tsconfig.json tsconfig.app.json .angular-cli.json
Update: Removing the
"files"key fromtsconfig.app.jsonfixed this issue for me. I believe"files"is auto-populated by ts if it's not specified, otherwise it exclusively uses the specified files (as mentioned in the tsconfig docs), which makes sense why it couldn't find a bunch of stuff.I did just recently do an upgrade of certain Angular packages, but this may be unrelated. I'm also the only non-Windows user to have this issue so far.
Had this problem as well on Mac Mojave 10.14.16, removing "files" from tsconfig.app.json solved it Thanks!
Thanks for reporting this issue. However, you didn't provide sufficient information for us to understand and reproduce the problem. Please check out our submission guidelines to understand why we can't act on issues that are lacking important information.
If the problem persists, please file a new issue and ensure you provide all of the required information when filling out the issue template.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.