Module build failed: Error: *****\src\main.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
Hello everybody, i can't launch my angular 5 app after create it : ng serve :
- angular CLI 1.5.5
- Node version : 8.9.1
- npm version : 5.5.1
Error
ERROR in C:/Users/public/Angular5/myapp/src/main.ts
Module build failed: Error: C:\Users\public\Angular5\myapp\src\main.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (C:\Users\public\Angular5\myapp\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:643:23)
at plugin.done.then (C:\Users\public\Angular5\myapp\node_modules@ngtools\webpack\src\loader.js:467:39)
at
In http://localhost:4200/ Cannot GET /
// package.json { "name": "myapp", "version": "0.0.0", "license": "MIT", "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" }, "private": true, "dependencies": { "@angular/animations": "^5.0.0", "@angular/common": "^5.0.0", "@angular/compiler": "^5.0.0", "@angular/core": "^5.0.0", "@angular/forms": "^5.0.0", "@angular/http": "^5.0.0", "@angular/platform-browser": "^5.0.0", "@angular/platform-browser-dynamic": "^5.0.0", "@angular/router": "^5.0.0", "core-js": "^2.4.1", "rxjs": "^5.5.2", "zone.js": "^0.8.14" }, "devDependencies": { "@angular/cli": "1.5.5", "@angular/compiler-cli": "^5.0.0", "@angular/language-service": "^5.0.0", "@types/jasmine": "~2.5.53", "@types/jasminewd2": "~2.0.2", "@types/node": "~6.0.60", "codelyzer": "^4.0.1", "jasmine-core": "~2.6.2", "jasmine-spec-reporter": "~4.1.0", "karma": "~1.7.0", "karma-chrome-launcher": "~2.1.1", "karma-cli": "~1.0.1", "karma-coverage-istanbul-reporter": "^1.2.1", "karma-jasmine": "~1.1.0", "karma-jasmine-html-reporter": "^0.2.2", "protractor": "~5.1.2", "ts-node": "~3.2.0", "tslint": "~5.7.0", "typescript": "~2.4.2" } }
//tsconfig.json { "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es5", "typeRoots": [ "node_modules/@types" ], "lib": [ "es2017", "dom" ] } }
Thank you in advance for your responses :)
This appears to be a duplicate of https://github.com/angular/angular-cli/issues/8284. Please see this https://github.com/angular/angular-cli/issues/8284#issuecomment-341417325 from the issue for further details and potential steps to solve the problem.
I do not believe this is a duplicate. I am also having the same issue.
I am on a fresh windows 7 install, with an LTS version of node (npm 5.5.1, node 8.9.3). angular cli version 1.6.0
I install angular and generate a project:
npm install -g @angular/cli
ng new demo
cd demo
ng serve
And I get the exact error posted above.
Hello Try : ng serve preserve symlinks
From: Jake Robers [email protected] Sent: Sunday, December 10, 2017 8:23:48 PM To: angular/angular-cli Cc: RAFBOUK; Author Subject: Re: [angular/angular-cli] Module build failed: Error: *****\src\main.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. (#8713)
I do not believe this is a duplicate. I am also having the same issue.
I am on a fresh windows 7 install, with an LTS version of node (npm 5.5.1, node 8.9.3).
I install angular and generate a project:
npm install -g @angular/cli ng new demo cd demo ng serve
And I get the exact error posted above.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/angular/angular-cli/issues/8713#issuecomment-350573884, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AbHXCbyxq376qYPL5O6k2wzUrGb88Lr_ks5s_C_EgaJpZM4QydLF.
I get the same error. I also downgraded to angular-cli 1.5.4, but that does not solve my issue either
ERROR in C:/Users/jake/Documents/angular-demo/src/main.ts
Module build failed: Error: C:\Users\jake\Documents\angular-demo\src\main.ts is
not part of the compilation. Please make sure it is in your tsconfig via the 'fi
les' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (C:\Users\jake\Documents\angular-de
mo\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:620:23)
at plugin.done.then (C:\Users\jake\Documents\angular-demo\node_modules\@ngto
ols\webpack\src\loader.js:467:39)
at <anonymous>
@ multi webpack-dev-server/client?http://0.0.0.0:0 ./src/main.ts
ERROR in C:/Users/jake/Documents/angular-demo/src/polyfills.ts
Module build failed: Error: C:\Users\jake\Documents\angular-demo\src\polyfills.t
s is not part of the compilation. Please make sure it is in your tsconfig via th
e 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (C:\Users\jake\Documents\angular-de
mo\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:620:23)
at plugin.done.then (C:\Users\jake\Documents\angular-demo\node_modules\@ngto
ols\webpack\src\loader.js:467:39)
at <anonymous>
@ multi ./src/polyfills.ts
It's my understanding that angular should be loading everything in the src directory, yet somehow it is not.
It works for me, I don't have another solution sorry :)
From: Jake Robers [email protected] Sent: Sunday, December 10, 2017 8:58:34 PM To: angular/angular-cli Cc: RAFBOUK; Author Subject: Re: [angular/angular-cli] Module build failed: Error: *****\src\main.ts is not part of the compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property. (#8713)
I get the same error. I also downgraded to angular-cli 1.5.4, but that does not solve my issue either
ERROR in C:/Users/jake/Documents/angular-demo/src/main.ts
Module build failed: Error: C:\Users\jake\Documents\angular-demo\src\main.ts is
not part of the compilation. Please make sure it is in your tsconfig via the 'fi
les' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (C:\Users\jake\Documents\angular-de
mo\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:620:23)
at plugin.done.then (C:\Users\jake\Documents\angular-demo\node_modules@ngto
ols\webpack\src\loader.js:467:39)
at
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/angular/angular-cli/issues/8713#issuecomment-350577025, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AbHXCcJKJxt757RbcjfxcJAMRnz_JedGks5s_DfqgaJpZM4QydLF.
Update for those having a similar issue:
One of the following things solved my issue, but I'm not sure which since I did them simultaneously:
- Downgrade to 1.4.9
- Run all ng commands as administrator (npm install, ng new, ng serve). Before I was only doing npm install as admin.
- Remove all dash characters from project name in the
ng newcommand
I'm also having this issue. While I agree its related to #8284, I'm not sure I agree its the same thing. The suggestion on that thread talks more about node_modules, where here its complaining about my main.ts and ployfill.ts. Creating a new project, everything seems to work, but upgrading my exists, nothing seems to work. DOA
I'm still having this issue but #8284 didn't help either
Same issue for me any fix for it available? Also #8284 do not works for me.
ng serve --preserve-symlinks fixed it for me. Tried the basic quickstart tutorial from angular.io, fresh npm/node install on Windows 10, same error as above even when running all commands as admin. The --preserve-symlinks flag seems to have solved the problem.
Angular CLI: 1.6.4 Angular: 5.2
yeah something about junctions on windows made my ng build and ng serve fail too, using --preserve-symlinks solved this issue for me.
I had the same issue and then I discovered the problem was that my project had the character "!" in it's project directory path (see the below path). When I removed the "!" in the folder name "Live!" it simply worked.
C:\Users\Lordkj\Desktop\All Projects\Live!\GraphQL\GitHunt-Angular-master
Running ng serve in the original directory instead in the directory of symlinks worked for me.
adding the --preserve-symlinks option to commands worked for me, as I said before...
I faced the same issue with code located on the network map. When I copy it to c: and it worked fine.
[D:\pwa\angular-material-pwa-master\angular-material-pwa-master\src\app\assets\images\homesel.gif] [D:\pwa\angular-material-pwa-master\angular-material-pwa-master\src\app\assets\images\homesel.gif.ts] [D:\pwa\angular-material-pwa-master\angular-material-pwa-master\src\app\assets\images\homesel.gif.js] [D:\pwa\angular-material-pwa-master\angular-material-pwa-master\src\app\assets\images\homesel.gif] @ ./src/app/app.component.scss 6:88-126 @ ./src/app/app.component.ts @ ./src/app/app.module.ts @ ./src/main.ts @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
face this issue please resolve it
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.