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

Missing typings directory

Open paulhilbert opened this issue 10 years ago • 13 comments

I got a broccoli/funnel error due to a missing typings directory

OS: Fresh Arch Linux (inside nspawn) Versions: angular-cli: 0.0.39 node: 6.0.0 npm: 3.8.8 Reproduce:

ng new proj

cd proj

ng serve

Observed Behaviour: ng serve (node:5196) 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. Could not start watchman; falling back to NodeWatcher for file system events. Visit http://ember-cli.com/user-guide/#watchman for more info. Livereload server on http://localhost:49152 Serving on http://localhost:4200/ The Broccoli Plugin: [Funnel] failed with: Error: Attempting to watch missing directory: typings at EventEmitter.Watcher_addWatchDir as addWatchDir at /.../node_modules/angular-cli/node_modules/angular-cli/node_modules/angular-cli-broccoli/lib/builder.js:95:35 at lib$rsvp$$internal$$tryCatch (/.../node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16) at lib$rsvp$$internal$$invokeCallback (/.../node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17) at /.../node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11 at lib$rsvp$asap$$flush (/.../node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)

The broccoli plugin was instantiated at: at Funnel.Plugin (/.../node_modules/angular-cli/node_modules/broccoli-funnel/node_modules/broccoli-plugin/index.js:7:31) at new Funnel (/.../node_modules/angular-cli/node_modules/broccoli-funnel/index.js:44:10) at Angular2App._buildInputTree (/.../node_modules/angular-cli/lib/broccoli/angular2-app.js:74:7) at new Angular2App (/.../node_modules/angular-cli/lib/broccoli/angular2-app.js:31:41) at module.exports (/.../angular-cli-build.js:6:10) at Class.module.exports.Task.extend.setupBroccoliBuilder (/.../node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:55:19) at Class.module.exports.Task.extend.init (/.../node_modules/angular-cli/node_modules/angular-cli/lib/models/builder.js:89:10) at new Class (/.../node_modules/angular-cli/node_modules/angular-cli/node_modules/core-object/core-object.js:18:12) at Class.module.exports.Task.extend.run (/.../node_modules/angular-cli/node_modules/angular-cli/lib/tasks/serve.js:15:19) at /.../node_modules/angular-cli/node_modules/angular-cli/lib/commands/serve.js:64:24 at lib$rsvp$$internal$$tryCatch (/.../node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1036:16) at lib$rsvp$$internal$$invokeCallback (/.../node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1048:17) at /.../node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:331:11 at lib$rsvp$asap$$flush (/.../node_modules/angular-cli/node_modules/angular-cli/node_modules/rsvp/dist/rsvp.js:1198:9) at _combinedTickCallback (internal/process/next_tick.js:67:7) at process._tickCallback (internal/process/next_tick.js:98:9)

Expected Behaviour: Don't fail.

paulhilbert avatar May 05 '16 09:05 paulhilbert

Probably because the scaffolding process didn't install the typings. Normally that should be a postinstall but it happens to me as well sometimes... I normally have the repo cloned locally and use that with npm link. Whenever I work on Ubuntu, after creating a new project I have to cd into it and do npm link angular-cli. That's when the postinstall never fires, but only on Ubuntu. (I don't know why but I don't care either). All you need to do is cd inside your project root directory and typings install.

monojack avatar May 05 '16 10:05 monojack

I'm experiencing the exact same error on OSX. @monojack: the typings directory doesn't exist, however "typings install" is not a known command for me, would you kindly explain more please? thanks

ashkank83 avatar May 06 '16 16:05 ashkank83

@ashkank83 that means you haven't installed typings globally. Run npm i -g typings first.

monojack avatar May 06 '16 19:05 monojack

@monojack thanks, after installing typings globally and running it as you recommended for the project. serve seems to be working fine now. Isn't typings supposed to be installed as part of dependencies when I install angular-cli? the postinstall task seems to be still an issue (I guess a bug) which needs to befixed.

ashkank83 avatar May 06 '16 22:05 ashkank83

Yea postinstallis not running for some reason on OSX either. A quick fix is to just do npm run postinstall manually in the root of your project directory. You should not need to install typings globally as it is being installed as an angular-cli dependency (at least for me).

camargo avatar May 13 '16 17:05 camargo

This is probably a permissions thing on your machine. See https://github.com/angular/angular-cli/issues/389#issuecomment-213420501.

To fix on OSX I installed node via brew (so I wouldn't have to run it as sudo). Before you install angular-cli, if you had previously installed node as sudo you will have to make sure you remove ~/.config/configsore/ember-cli.json, ~/.config/configsore/typings.json, and ~/.config/configsore/update-notifier-typings.json. This is because we do not want the owner of these files to be root.

camargo avatar May 16 '16 18:05 camargo

Thanks @camargo

npm run postinstall

This works for me. Centos 6

groundbreaker08 avatar Jun 02 '16 06:06 groundbreaker08

Yeah I don't know why doesn't typings install sometimes. We also have the same problem in the angular/quickstart repo really. npm run postinstall is the best way to do it, since it'll use the local typings version.

filipesilva avatar Jun 02 '16 14:06 filipesilva

A quick fix is to just do npm run postinstall manually in the root of your project directory.

Thank you, mate. Finally I found solution that works!

ArMikael avatar Jul 05 '16 05:07 ArMikael

I am using OpenSuse leap 42.1 and that the issue still persists(using it as root/superuses) but using - npm run postinstall worked for me as well

rvmladenov avatar Jul 06 '16 20:07 rvmladenov

Is there any reason why the project relies on globally installed packages, rather than including them in packages.json and utilizing the tools like: "start": "node_modules/angular-cli/bin ng serve", and "postinstall": "node_modules/.bin/typings install", Wouldn't this make setting up a project for a brand new developer / machine, and updating a lot easier for everyone?

azanebrain avatar Oct 14 '16 00:10 azanebrain

@azanebrain Yes, it's typically better practice to use local packages instead of global ones for reasons like you said

camargo avatar Oct 14 '16 01:10 camargo

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.