Angular-cli: Uncaught TypeError: fs.existsSync is not a function

Created on 4 Sep 2017  路  4Comments  路  Source: angular/angular-cli

Bug Report or Feature Request (mark with an x)

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

Versions.

@angular/cli: 1.3.2
node: 8.1.0
os: darwin x64
@angular/animations: 4.3.6
@angular/common: 4.3.6
@angular/compiler: 4.3.6
@angular/core: 4.3.6
@angular/forms: 4.3.6
@angular/http: 4.3.6
@angular/platform-browser: 4.3.6
@angular/platform-browser-dynamic: 4.3.6
@angular/router: 4.3.6
@angular/cli: 1.3.2
@angular/compiler-cli: 4.3.6
@angular/language-service: 4.3.6

Repro steps.

  1. Run npm install on a existing CLI project on a new machine
  2. Run ng serve
  3. Build succeeds
  4. Error during run time in the browser console (it works on other machines)

The log given by the failure.

devmode.js:33 Uncaught TypeError: fs.existsSync is not a function
    at devmode.js:33
    at Object.<anonymous> (devmode.js:34)
    at Object.../../../../selenium-webdriver/lib/devmode.js (devmode.js:34)
    at __webpack_require__ (bootstrap e5f73d06e393ede3682a:54)
    at Object.<anonymous> (http.js:32)
    at Object.../../../../selenium-webdriver/lib/http.js (http.js:567)
    at __webpack_require__ (bootstrap e5f73d06e393ede3682a:54)
    at Object.<anonymous> (index.js:29)
    at Object.../../../../selenium-webdriver/http/index.js (index.js:255)
    at __webpack_require__ (bootstrap e5f73d06e393ede3682a:54)
(anonymous) @ devmode.js:33
(anonymous) @ devmode.js:34
../../../../selenium-webdriver/lib/devmode.js @ devmode.js:34
__webpack_require__ @ bootstrap e5f73d06e393ede3682a:54
(anonymous) @ http.js:32
../../../../selenium-webdriver/lib/http.js @ http.js:567
__webpack_require__ @ bootstrap e5f73d06e393ede3682a:54
(anonymous) @ index.js:29
../../../../selenium-webdriver/http/index.js @ index.js:255
__webpack_require__ @ bootstrap e5f73d06e393ede3682a:54
../../../../../src/app/upload.service.ts @ route-two.component.ts:8
__webpack_require__ @ bootstrap e5f73d06e393ede3682a:54
../../../../../src/app/app.module.ts @ app.component.ts:12
__webpack_require__ @ bootstrap e5f73d06e393ede3682a:54
../../../../../src/main.ts @ environment.ts:8
__webpack_require__ @ bootstrap e5f73d06e393ede3682a:54
0 @ main.ts:11
__webpack_require__ @ bootstrap e5f73d06e393ede3682a:54
webpackJsonpCallback @ bootstrap e5f73d06e393ede3682a:25
(anonymous) @ main.bundle.js:1

Desired functionality.

I'm not sure what causes this error or how to fix it. It seems weird that the stack trace is pointing to webdriver, when I'm not running any e2e tests.

Most helpful comment

Well, it appears to have been a rogue auto-import from WebStorm. It was importing HttpClient from WebDriver and not Angular.

All 4 comments

Well, it appears to have been a rogue auto-import from WebStorm. It was importing HttpClient from WebDriver and not Angular.

I am new to Angular, I am getting the same error, could you please tell me where to make this change to fix this issue?

Error appears, becoz HttpClient is imported from 'selenium-webdriver/http'

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