angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

@ngtools/webpack TS Error on build of project

Open timwright35 opened this issue 9 years ago • 9 comments

Bug Report or Feature Request (mark with an x)

- [X] bug report -> please search issues before submitting
- [ ] feature request

Versions.

Node 8.1.0 NPM 5.0.3 ngtools/webpack 1.7.0-beta.2 Angular 5.0.0-beta.2 Typescript 2.4.2

The log given by the failure.

TS2420: Class 'VirtualStats' incorrectly implements interface 'Stats'. Property 'atimeMs' is missing in type 'VirtualStats'.

Desired functionality.

Compiles correctly

timwright35 avatar Aug 22 '17 22:08 timwright35

I have the same problem. It only happens with awesome-typescript-loader. Switching to ts-loader resolved the problem for me.

andrewpmontgomery avatar Aug 23 '17 17:08 andrewpmontgomery

I just tried changing to ts-loader, same error. Care to share your part of the config that you have setup, see if I am doing it right.

timwright35 avatar Aug 23 '17 21:08 timwright35

Temporary solved it by adding the following attributed from fs.Stats to the VirtualStats class readonly atimeMs: number; readonly mtimeMs: number; readonly ctimeMs: number; readonly birthtimeMs: number;

Seems like the node api changed..

Using:

  • node 8.1.3
  • npm 5.2.0
  • types/node 8.0.25
  • ngtools/webpack 1.6.2

MartinJK avatar Aug 27 '17 16:08 MartinJK

Downgrading to @types/node 8.0.19 temporary solved the problem.

dogmatico avatar Aug 28 '17 07:08 dogmatico

Unfortunately still an issue. :(

stemda avatar Feb 15 '18 16:02 stemda

You can work around this without downgrading @types/node by adding the following to a .d.ts file, and making sure that file is included in your tsconfig.json:

// https://github.com/angular/angular-cli/issues/7474
import { VirtualStats } from '@ngtools/webpack/src/compiler_host';
import * as fs from 'fs';

declare module '@ngtools/webpack/src/compiler_host' {
    interface VirtualStats extends fs.Stats {
        atimeMs: number;
    }
}

DanielSchaffer avatar Mar 01 '18 19:03 DanielSchaffer

Can you still reproduce this error?

mgechev avatar Dec 18 '18 23:12 mgechev

Closing the issue due to inactivity. If the problem still exists in the latest version of the CLI, please open a new issue following the template and providing a minimal demo where we can reproduce it. Thanks! :-)

mgechev avatar Dec 21 '18 22:12 mgechev

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.