flauc / angular2-notifications

A light and easy to use notifications library for Angular.
https://stackblitz.com/edit/angular2-notifications-example
MIT License
746 stars 167 forks source link

Unable to build the library #31

Closed olakara closed 6 years ago

olakara commented 8 years ago

Hi, I just cloned the lib and tried to npm run build, I get the following error:

error-ng2-notifications

λ npm run build

angular2-notifications@0.1.56 build C:\Users\Abdel\Desktop\angular2-notifications tsc

node_modules/@angular/core/src/application_ref.d.ts(39,88): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/application_ref.d.ts(99,42): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/application_ref.d.ts(174,33): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(24,15): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(26,16): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/di/reflective_provider.d.ts(105,123): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/di/reflective_provider.d.ts(105,165): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/facade/async.d.ts(27,33): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/facade/async.d.ts(28,45): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/facade/collection.d.ts(1,25): error TS2304: Cannot find name 'MapConstructor'. node_modules/@angular/core/src/facade/collection.d.ts(2,25): error TS2304: Cannot find name 'SetConstructor'. node_modules/@angular/core/src/facade/collection.d.ts(4,27): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/facade/collection.d.ts(4,39): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/facade/collection.d.ts(7,9): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/facade/collection.d.ts(8,30): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/facade/collection.d.ts(11,43): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/facade/collection.d.ts(12,27): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/facade/collection.d.ts(14,23): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/facade/collection.d.ts(15,25): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/facade/collection.d.ts(100,41): error TS2304: Cannot find name 'Set'. node_modules/@angular/core/src/facade/collection.d.ts(101,22): error TS2304: Cannot find name 'Set'. node_modules/@angular/core/src/facade/collection.d.ts(102,25): error TS2304: Cannot find name 'Set'. node_modules/@angular/core/src/facade/lang.d.ts(4,17): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/facade/lang.d.ts(5,17): error TS2304: Cannot find name 'Set'. node_modules/@angular/core/src/facade/lang.d.ts(70,59): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/facade/promise.d.ts(2,14): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/facade/promise.d.ts(8,32): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/facade/promise.d.ts(9,38): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/facade/promise.d.ts(10,35): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/facade/promise.d.ts(10,93): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/facade/promise.d.ts(11,34): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/facade/promise.d.ts(11,50): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/facade/promise.d.ts(12,32): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/facade/promise.d.ts(12,149): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/facade/promise.d.ts(13,43): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/linker/component_resolver.d.ts(8,53): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/linker/component_resolver.d.ts(12,44): error TS2304: Cannot find name 'Promise'.

node_modules/@angular/core/src/linker/dynamic_component_loader.d.ts(62,148): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/linker/dynamic_component_loader.d.ts(103,144): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/linker/dynamic_component_loader.d.ts(108,139): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/linker/dynamic_component_loader.d.ts(109,135): error TS2304: Cannot find name 'Promise'. node_modules/@angular/core/src/reflection/reflector.d.ts(28,22): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/reflection/reflector.d.ts(30,15): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/reflection/reflector.d.ts(32,15): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/reflection/reflector.d.ts(34,15): error TS2304: Cannot find name 'Map'. node_modules/@angular/core/src/reflection/reflector.d.ts(36,16): error TS2304: Cannot find name 'Set'. node_modules/@angular/core/src/testability/testability.d.ts(40,20): error TS2304: Cannot find name 'Map'. node_modules/rxjs/Observable.d.ts(10,66): error TS2304: Cannot find name 'Promise'. node_modules/rxjs/Observable.d.ts(66,60): error TS2304: Cannot find name 'Promise'. node_modules/rxjs/Observable.d.ts(66,70): error TS2304: Cannot find name 'Promise'. src/pushNotifications.service.ts(10,18): error TS4073: Parameter 'data' of public method from exported class has or is using private name 'PushNotification'.

npm ERR! Windows_NT 10.0.10586 npm ERR! argv "D:\NodeJS\node.exe" "D:\NodeJS\node_modules\npm\bin\npm-cli.js" "run" "build" npm ERR! node v4.2.1 npm ERR! npm v3.9.5 npm ERR! code ELIFECYCLE npm ERR! angular2-notifications@0.1.56 build: tsc npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the angular2-notifications@0.1.56 build script 'tsc'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the angular2-notifications package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! tsc npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs angular2-notifications npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls angular2-notifications npm ERR! There is likely additional logging output above.

Any clue what I am doing wrong?

flauc commented 8 years ago

Hi olakara,

Yes i simply can't figure out why this happens (i get the same errors), but the only command that build runs is tsc so if you call the command tsc at the root everything should compile and you're good to go.

olakara commented 8 years ago

Hi @flauc , yes, I tried it and got it compiled.. but when I add the lib to my application, things don't work out.. I get the same set of errors and my application don't work :(

jbouzekri commented 8 years ago

Since RC of angular, the es6-shim typings have been removed from the core. So the compiler does not understand all these references to es6 classes. The pull request #32 should fix this.

flauc commented 8 years ago

Hi @jbouzekri,

Thank you for your help. I just have one question before i merge. Why remove this line from package.json:

"main": "./components.js",

It's related to this issue #28

jbouzekri commented 8 years ago

@flauc : I have just moved it at the bottom of the file to have the dependencies and the references to project file together (typings + main).

flauc commented 8 years ago

Wow i'm blind sorry. Once again thank you :+1:

hoangnguyenba commented 8 years ago

I get the same error, can't build source and example also :(

armno commented 7 years ago

I also got errors from running npm run build (cloned at the latest commit: 3a7934951875a80714c43a21e43bc05599524d7c):

$ npm run build

> angular2-notifications@0.3.3 build /Users/armno/code/forks/angular2-notifications
> typings install && tsc

└── es6-shim (ambient)

src/push-notifications.service.ts(19,31): error TS2339: Property 'createBuffered' does not exist on type 'PushNotificationsService'.

Here are what I have done to get it runs:

  1. Run npm install in project's root directory and also inside of /example directory.
  2. Run npm run build from root directory, got the error above. The code in push-notifications.service.ts was commented out. I uncomment them and run npm run build again. It works.
  3. Run gulp serve from root directory. It serves files from /example but I got 404 on /app/main.js from devtools' console.
  4. Then I cd example/ and run ./node_modules/typescript/bin/tsc command, got many errors (attached below) but it still compiles.
  5. Go back to project root and run gulp serve again. Now the notification module works.

(errors from 4.)

app/pusnNotifications.service.ts(28,20): error TS2304: Cannot find name 'Promise'.
app/pusnNotifications.service.ts(50,14): error TS2339: Property 'canCreate' does not exist on type 'PushNotificationsService'.
app/pusnNotifications.service.ts(51,18): error TS2339: Property 'notificationBuffer' does not exist on type 'PushNotificationsService'.
app/pusnNotifications.service.ts(52,13): error TS2346: Supplied parameters do not match any signature of call target.
app/pusnNotifications.service.ts(52,30): error TS2339: Property 'notificationBuffer' does not exist on type 'PushNotificationsService'.
app/pusnNotifications.service.ts(53,18): error TS2339: Property 'notificationBuffer' does not exist on type 'PushNotificationsService'.
node_modules/@angular/common/src/directives/ng_class.d.ts(81,34): error TS2304: Cannot find name 'Set'.
node_modules/@angular/common/src/pipes/async_pipe.d.ts(41,38): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(345,20): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/compile_metadata.d.ts(346,15): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/directive_normalizer.d.ts(19,100): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/directive_normalizer.d.ts(21,74): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/offline_compiler.d.ts(15,26): error TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/offline_compiler.d.ts(16,38): error TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/offline_compiler.d.ts(31,124): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/output/output_ast.d.ts(424,63): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/resource_loader.d.ts(13,23): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/runtime_compiler.d.ts(40,49): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/runtime_compiler.d.ts(42,65): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/template_parser/template_parser.d.ts(45,12): error TS2304: Cannot find name 'Set'.
node_modules/@angular/compiler/src/util.d.ts(35,18): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/util.d.ts(36,46): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/compiler/src/view_compiler/compile_element.d.ts(33,16): error TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/view_compiler/compile_query.d.ts(24,49): error TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/view_compiler/compile_view.d.ts(29,18): error TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/view_compiler/compile_view.d.ts(51,16): error TS2304: Cannot find name 'Map'.
node_modules/@angular/compiler/src/view_compiler/compile_view.d.ts(53,13): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/application_init.d.ts(16,18): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(106,67): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(122,101): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(148,67): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/application_ref.d.ts(150,101): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(24,15): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/change_detection/differs/default_keyvalue_differ.d.ts(28,16): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(88,123): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/di/reflective_provider.d.ts(88,165): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(2,25): error TS2304: Cannot find name 'MapConstructor'.
node_modules/@angular/core/src/facade/collection.d.ts(3,25): error TS2304: Cannot find name 'SetConstructor'.
node_modules/@angular/core/src/facade/collection.d.ts(5,27): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(5,39): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(8,9): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(9,30): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(12,43): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(13,27): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(15,23): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(16,25): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/collection.d.ts(101,41): error TS2304: Cannot find name 'Set'.
node_modules/@angular/core/src/facade/collection.d.ts(102,22): error TS2304: Cannot find name 'Set'.
node_modules/@angular/core/src/facade/collection.d.ts(103,25): error TS2304: Cannot find name 'Set'.
node_modules/@angular/core/src/facade/lang.d.ts(12,17): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/facade/lang.d.ts(13,17): error TS2304: Cannot find name 'Set'.
node_modules/@angular/core/src/facade/lang.d.ts(51,59): error TS2304: Cannot find name 'Map'.
node_modules/@angular/core/src/linker/compiler.d.ts(53,49): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/compiler.d.ts(61,65): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/ng_module_factory_loader.d.ts(14,34): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts(28,25): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/forms/src/directives.d.ts(26,46): error TS2314: Generic type 'Type<T>' requires 1 type argument(s).
node_modules/@angular/forms/src/directives.d.ts(27,50): error TS2314: Generic type 'Type<T>' requires 1 type argument(s).
node_modules/@angular/forms/src/directives.d.ts(28,50): error TS2314: Generic type 'Type<T>' requires 1 type argument(s).
node_modules/@angular/forms/src/directives.d.ts(46,39): error TS2314: Generic type 'Type<T>' requires 1 type argument(s).
node_modules/@angular/forms/src/directives.d.ts(50,48): error TS2314: Generic type 'Type<T>' requires 1 type argument(s).
node_modules/@angular/forms/src/directives/select_multiple_control_value_accessor.d.ts(12,18): error TS2314: Generic type 'Type<T>' requires 1 type argument(s).
node_modules/@angular/forms/src/form_providers.d.ts(13,38): error TS2314: Generic type 'Type<T>' requires 1 type argument(s).
node_modules/@angular/forms/src/form_providers.d.ts(18,47): error TS2314: Generic type 'Type<T>' requires 1 type argument(s).
node_modules/@angular/platform-browser-dynamic/src/resource_loader/resource_loader_impl.d.ts(10,23): error TS2304: Cannot find name 'Promise'.
node_modules/@angular/platform-browser/src/browser/browser_adapter.d.ts(79,33): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/dom/dom_adapter.d.ts(97,42): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/dom/dom_renderer.d.ts(18,37): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(2,25): error TS2304: Cannot find name 'MapConstructor'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(3,25): error TS2304: Cannot find name 'SetConstructor'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(5,27): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(5,39): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(8,9): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(9,30): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(12,43): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(13,27): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(15,23): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(16,25): error TS2304: Cannot find name 'Map'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(101,41): error TS2304: Cannot find name 'Set'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(102,22): error TS2304: Cannot find name 'Set'.
node_modules/@angular/platform-browser/src/facade/collection.d.ts(103,25): error TS2304: Cannot find name 'Set'.
node_modules/rxjs/Observable.d.ts(10,66): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/Observable.d.ts(66,60): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/Observable.d.ts(66,70): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/observable/PromiseObservable.d.ts(40,31): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/observable/PromiseObservable.d.ts(41,26): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/operator/toPromise.d.ts(7,59): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/operator/toPromise.d.ts(7,69): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/operator/toPromise.d.ts(9,9): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/operator/toPromise.d.ts(10,26): error TS2304: Cannot find name 'Promise'.
node_modules/rxjs/operator/toPromise.d.ts(10,36): error TS2304: Cannot find name 'Promise'.

@flauc Could you explain how you set up dev environment please? Are there any thing required beyond package.jsons (e.g. globally installed node modules & their versions)?

sergiocosus commented 7 years ago

This pull request should fix this issue #85 Solution based in this http://stackoverflow.com/a/37758982/5280365