4

I'm trying to create a new Angular 5 project. I've installed @angular/cli version 1.6.3 and typed:

ng new project --routing

After everything has been installed I did:

cd project
ng build

And got the following errors:

Module build failed: Error: d:...\project\src\main.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.

Module build failed: Error: d:...\project\src\polyfills.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.

There are a couple of discussions about this on the Angular github page, but other than saying this has been resolved, or pointing to an issue where there where ts files in node_modules - it was not helpful.

We're using Windows 10 here.

EDIT: the tsconfig files are (there are two):

{
  "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"
    ]
  }
}

The other (src/tsconfig.app.json):

{
  "extends": "../tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "es2015",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ]
}

These were both created by ng new.

8
  • Already tried to uninstall and reinstall angular/cli? Commented Jan 8, 2018 at 10:38
  • Yes. And again, this happened on several computers. Downgrading to angular-cli 1.4.4 fixes this problem, but uses Angular 4 and not 5. This is what we're going to do for now, but it's hardly a solution. Commented Jan 8, 2018 at 10:44
  • Can you post tsconfig? Commented Jan 8, 2018 at 10:52
  • Posted, although I doubt they will help. Adding an include section to either of them did not help. Commented Jan 8, 2018 at 11:20
  • 1
    Was this ever solved? Commented Jun 6, 2018 at 18:59

2 Answers 2

1

Oh dear, I forgot to answer this question! It was answered in the Angular github a long time ago.

In Angular 5 you need to add --preserve-symlinks to both ng build and ng serve.

In Angular 6 you can no longer do that, and instead you need to add

 "preserveSymlinks": true,

to angular.json, you put it under architect/build/options of your project.

Sign up to request clarification or add additional context in comments.

Comments

0

Verify that you are running at least node 6.9.x and npm 3.x.x by running node -v and npm -v in a terminal/console window. Older versions produce errors, but newer versions are fine.

1 Comment

I'm using node 8.9 and npm 5.5.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.