Angular-cli: Failed to start with TS2307: Cannot find module 'path'.

Created on 10 Jan 2018  路  6Comments  路  Source: angular/angular-cli

Versions

$ ng --version

Angular CLI: 1.6.3
Node: 6.9.5
OS: darwin x64
Angular: 5.2.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.3
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.3
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0
npm -v
5.6.0
node -v
v6.9.5



md5-d5ac2a37e571b0c3134fb651baab4e1d



** NG Live Development Server is listening on localhost:4200, open your browser on http://localhost:4200/ **
Date: 2018-01-10T05:57:58.228Z                                                       
Hash: 0924bf2d2d00305e83d8
Time: 7840ms
chunk {inline} inline.bundle.js (inline) 5.79 kB [entry] [rendered]
chunk {main} main.bundle.js (main) 2.93 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js (polyfills) 636 bytes [initial] [rendered]
chunk {styles} styles.bundle.js (styles) 863 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js (vendor) 853 kB [initial] [rendered]

ERROR in node_modules/@angular/compiler-cli/src/transformers/program.d.ts(9,23): error TS2307: Cannot find module 'path'.


webpack: Failed to compile.
more info 2 (required) bufix

Most helpful comment

Resolved, remove typo import from source code:

import {exitCodeFromResult} from '@angular/compiler-cli';

All 6 comments

Resolved, remove typo import from source code:

import {exitCodeFromResult} from '@angular/compiler-cli';

yep, i also got that rogue import somehow, and removing it also fixed the problem

i also got this error. it was introduced while i was commenting on my code in app.module.ts. i used the word "build" in a comment and my editor auto imported: import {build} from 'ng-packagr';

which i didn't notice.

removing the import solved the problem.

I also faced same issue due to typo import into the app.module.ts module. after removing it fixed the problem

i also got the same error, it was created when i used the word random and counter. it went off when i removed the imported lines.

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._

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MateenKadwaikar picture MateenKadwaikar  路  3Comments

rwillmer picture rwillmer  路  3Comments

rajjejosefsson picture rajjejosefsson  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

hareeshav picture hareeshav  路  3Comments