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

Cannot find module 'exists-sync'

Open cre8 opened this issue 10 years ago • 48 comments

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?) os: Windows 10

  2. Versions. Please run ng --version. If there's nothing outputted, please angular-cli: 1.0.0-beta.8 node: 6.2.2 os: win32 x64

  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you do on your code? etc. I updated to the latest cli version (beta 8). When I run ng outside the project it shows me all the options. But when I run it inside my project I get an error.

  4. The log given by the failure. Normally this include a stack trace and some more information. 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. (C:\xampp\htdocs\foo1\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)

  5. Mention any other details that might be useful.


    Thanks! We'll be in touch soon.

cre8 avatar Jun 23 '16 19:06 cre8

+1

However npm instal did not solve the problem for me. I do have to run it as root on mac sudo npm install which seems to be really bad practice for me.

I'm running on node 6.2.2 with latest npm 3.10.2

npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.2.2
npm ERR! npm  v3.10.2
npm ERR! path ../typescript/bin/tsc
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall symlink

npm ERR! Error: EACCES: permission denied, symlink '../typescript/bin/tsc' -> '/Users/manuelfink/git/angular-2-test/node_modules/angular-cli/node_modules/.bin/tsc'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, symlink '../typescript/bin/tsc' -> '/Users/manuelfink/git/angular-2-test/node_modules/angular-cli/node_modules/.bin/tsc'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'symlink',
npm ERR!   path: '../typescript/bin/tsc',
npm ERR!   dest: '/Users/manuelfink/git/angular-2-test/node_modules/angular-cli/node_modules/.bin/tsc',
npm ERR!   parent: 'angular-cli' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.2.2
npm ERR! npm  v3.10.2
npm ERR! path npm-debug.log.2854708998
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open

manuelfink avatar Jun 27 '16 11:06 manuelfink

In linux or mac OS you need sudo while running npm if you want to run without sudo you should use nvm or follow the instructions given in here. This is not an issue and it is not related to angular-cli

Rafi993 avatar Jun 27 '16 13:06 Rafi993

@cre8 please close the issue if it is solved.

Rafi993 avatar Jun 27 '16 13:06 Rafi993

@Rafi993 it seems to be that this is not resolves as of now.

  • .beta8 is missing the above dependencies, which must be manually installed to get angular cli running and than be manually installed within every project.
  • I do agree that root is necessary for installing global packages. However running npm within a project as sudo seems weird to me. Still I'm anyhow not even understanding why I need root privileges for a subfolder which belongs to my user. Maybe just a problem of my mac.

manuelfink avatar Jun 27 '16 14:06 manuelfink

This comment https://github.com/angular/angular-cli/issues/1186#issuecomment-228691834 describes the actual issue very well.

@filipesilva are we planning to add those dependencies to dependencies ? Otherwise the command is simply globally broken.

0x-r4bbit avatar Jun 28 '16 06:06 0x-r4bbit

Hi everyone, apologies for taking so long to address this issue. First of all, thank you for all the comments and proposed temporary solutions.

Reading through the thread allowed me to zone into the real issue - the way ng new ran npm. Turns out it was using a 2.x.x npm internally. This is why when you did npm install things just worked again, your global npm version was more recent.

Simply adding these missing dependencies to the project was not the solution, because the problem was that npm wasn't correctly installing them in the first place.

I created a PR that updates the local npm to 3.10.2. That should fix all these issues.

filipesilva avatar Jun 30 '16 02:06 filipesilva

I get the same when ng new projectName

Ubuntu 16.04 LTS Nodejs v4.4.7 LTS npm v2.15.8

FYI: I manage to update npm and it fixed the issue. Thanks :+1:

warapitiya avatar Jun 30 '16 12:06 warapitiya

Updating to the latest version of npm then reinstalling angular-cli worked for me.

jackvial avatar Jul 01 '16 02:07 jackvial

Fresh install right now Windows 10 versions :

  • node : 4.4.7
  • npm : 2.15.8 Can't create new project returning error :
module.js:327
    throw err;
    ^

Error: Cannot find module 'through'
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at new UI (C:\Users\seny\AppData\Roaming\npm\node_modules\angular-cli\node_modules\ember-cli\lib\ui\index.js:37:19)
    at module.exports (C:\Users\seny\AppData\Roaming\npm\node_modules\angular-cli\node_modules\ember-cli\lib\cli\index.js:41:12)
    at module.exports (C:\Users\seny\AppData\Roaming\npm\node_modules\angular-cli\lib\cli\index.js:106:10)
    at C:\Users\seny\AppData\Roaming\npm\node_modules\angular-cli\bin\ng:31:5
    at C:\Users\seny\AppData\Roaming\npm\node_modules\angular-cli\node_modules\resolve\lib\async.js:46:14
    at process (C:\Users\seny\AppData\Roaming\npm\node_modules\angular-cli\node_modules\resolve\lib\async.js:173:43)

So go in : C:\Users\senayar\AppData\Roaming\npm\node_modules\angular-cli

and run npm i

finally got the same problem running ng serve after this :

Updating npm was the solution : npm install npm -g

npm : 3.10.3

rbinsztock avatar Jul 02 '16 08:07 rbinsztock

@senayar yes that is still needed until beta.9 is released if you aren't using the master version.

Splaktar avatar Jul 02 '16 12:07 Splaktar

I get this error message when I try to create new ng project | Os X El Capitan

ng new tg module.js:327 throw err; ^

Error: Cannot find module 'exists-sync' at Function.Module._resolveFilename (module.js:325:15) at Function.Module._load (module.js:276:25) at Module.require (module.js:353:17) at require (internal/module.js:12:17) at Object. (/usr/local/lib/node_modules/angular-cli/node_modules/ember-cli/lib/models/project.js:11:26) at Module._compile (module.js:409:26) at Object.Module._extensions..js (module.js:416:10) at Module.load (module.js:343:32) at Function.Module._load (module.js:300:12) at Module.require (module.js:353:17)

ghost avatar Jul 03 '16 16:07 ghost

As @Splaktar mentioned, the fix will be out in the next beta (beta.9).

Meanwhile what you can do is to delete node_modules inside your project and run npm install. That should fix every missing module.

filipesilva avatar Jul 03 '16 21:07 filipesilva

Updating npm to the latest version fixed the issue for me too.

msiddiqi avatar Jul 04 '16 02:07 msiddiqi

fresh install of windows 10, new download of node.js, while it installed ng without a problem it hit the sync issue immediately. I've got no package.json file to run, just following a tutorial to

npm install -g angular-cli

ng help

and i get the errors.

rbnzdave avatar Jul 04 '16 04:07 rbnzdave

@rbnzdave scroll up, then install dev dependencies for angular-cli :up:

tieppt avatar Jul 04 '16 09:07 tieppt

New shit happens, I downloaded the node 6.x.x latest version it works fine for the ng new project command, but when I type ng serve it pops up an throw error

Envoyé de mon iPhone

Le 4 juil. 2016 à 12:00, Tiep Phan [email protected] a écrit :

@rbnzdave scroll up, then install dev dependencies for angular-cli 🆙

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.

ghost avatar Jul 04 '16 19:07 ghost

Just do npm install in your project. That fixed it for me.

msiddiqi avatar Jul 04 '16 19:07 msiddiqi

I did it in /node_modules and in my project, So I really don’t understand

On 4 juillet 2016 at 21:30:50, Muhammad Siddiqi ([email protected]) wrote:

Just do npm install in your project. That fixed it for me.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/1186#issuecomment-230345286, or mute the thread https://github.com/notifications/unsubscribe/AKTOFMbBepH69dFIPy2aAnvrll2fuYu6ks5qSV9pgaJpZM4I9KfJ .

ghost avatar Jul 04 '16 19:07 ghost

@tieppt yeah was going to do that today, was just pointing out that a fresh install of everything wasn't working either so wasnt just "update npm" :)

rbnzdave avatar Jul 04 '16 21:07 rbnzdave

using npm i -D [items] didnt work for me, i had to

npm install -g exists-sync
npm install -g object-assign
npm install -g minimatch
npm install -g walk-sync
npm install -g through

and now npm new reddit-clone is actually doing something for me. (following r33 tutorial mp4 from ng-book2. totally recommend)

--update : and now ng serve is failing from not being able to find 'exists-sync' think i've got bigger problems somewhere.

--update 2 : apparently a fresh install of node.js doesnt include an updated npm. ran

npm install -g npm

and then ng serve works fine. I'm almost ready to wipe out nodejs/npm completely and re-install just to see if that was the issue the whole time. if you are having issues, like me, and

npm -v 

doesnt get you at least 3.x.x etc, you will need to manually install npm to get the latest version.

rbnzdave avatar Jul 04 '16 21:07 rbnzdave