Angular-cli: Error: Cannot find module 'exists-sync'

Created on 24 Jun 2016  路  8Comments  路  Source: angular/angular-cli

osx: El Captain,
node: v 6.2.2,
npm: v 3.10.3

Angular cli created new project well, but when I using ' ng server ' to start the server following error comes out. Anybody knows how to solve?

Error: Cannot find module 'exists-sync'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object. (/Users/Mars/Google Drive/Front-End/Project1/hello/node_modules/angular-cli/node_modules/ember-cli/lib/models/project.js:11:26)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)

Most helpful comment

@Marswang92
I also received the same error when running 'ng serve' after creation of a new project with angular-cli. To solve this, I ran the "npm install" command from within the new project's folder. I was then able to run "ng serve" successfully.

All 8 comments

Running this command fixed the issue for me. It will install the missing module 'exists-sync':
npm install --save exists-sync

@swfree
Thx! But after installing the module it stiil crashed when I try to start the server. This time the error message looks like

(node:7087) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
Livereload server on http://localhost:49152
Serving on http://localhost:4200/
The Broccoli Plugin: [BroccoliTypeScriptCompiler] failed with:
Error: Typescript found the following errors:
.../Project1/hello/tmp/broccoli_type_script_compiler-input_base_path-dvBqPqwe.tmp/0/src/typings.d.ts (5, 1): File '.../Project1/hello/tmp/broccoli_type_script_compiler-input_base_path-dvBqPqwe.tmp/0/typings/browser.d.ts' not found.

@Marswang92
This seems to be an error related to how typings was configured. Maybe it can be solved by creating a browser.d.ts file in your typings folder. I'm not too sure though, so you might be able to find a solution by looking at responses to some other similar issues:
https://github.com/typings/typings/issues/151
https://github.com/angular/angular/issues/5807
https://github.com/Microsoft/TypeScript/issues/7369

@Marswang92
I also received the same error when running 'ng serve' after creation of a new project with angular-cli. To solve this, I ran the "npm install" command from within the new project's folder. I was then able to run "ng serve" successfully.

I had similar issues while running:
npm version 2.14.12
node version 4.3.0

After updating to node version 6.2.2 and npm 3.9.5 all is working OK.

Maybe worth giving that a shot?

Duplicate of #1186. This should be closed.

Run npm install in the angular-cli folder globally and then run ng -v to check if working. After you have created a new project with the ng new command and ng serve should not work until you go into node_modules and angular-cli in your root project and npm install again.

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