Skip to content

Getting 404 error #58

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
superzaky opened this issue Aug 16, 2016 · 11 comments
Closed

Getting 404 error #58

superzaky opened this issue Aug 16, 2016 · 11 comments

Comments

@superzaky
Copy link

superzaky commented Aug 16, 2016

I want to use this library, but I'm getting the following error: Error: Error: XHR error (404 Not Found) loading http://localhost:8000/angular2-notifications(…)

It says 404 not found, but when I click on NotificationsService in my IDE then it goes to the declaration.

Also I did followed your example. Here is my commit where you can see that I had followed your example:
superzaky/node-portfolio-zaky@9ff7b4d

Am I missing something or am I doing something wrong?

@flauc
Copy link
Owner

flauc commented Aug 16, 2016

HI @superzaky, i don't know if this is the issue that is causing the error but for starters try removing NotificationsService from the providers array on line 10 of public/app/components/login/login.component.ts.

You don't need to register the provider again in your components the SimpleNotificationsModule does that for you on bootstrap.

@superzaky
Copy link
Author

superzaky commented Aug 17, 2016

Hello @flauc thanks for your reply, but that didn't solved it unfortunately. The problem still occurs..

@flauc
Copy link
Owner

flauc commented Aug 17, 2016

I'll have a look at the project over the weekend. Sorry i can't help sooner.

@ersinpw
Copy link

ersinpw commented Aug 27, 2016

Same problem here :(

@oytuntez
Copy link
Contributor

Could this be related to #25? See replies by @rkralston and @oytuntez.

@ashajjar
Copy link

ashajjar commented Sep 4, 2016

I am getting the same error... I am using 0.3.0 with rc5 any solutions? suggestions?

@ashajjar
Copy link

ashajjar commented Sep 7, 2016

hey guys I solved the problem, and it turned out to be system config issue, I will guide you through what I've done step-by-step:

1- Update your angular-cli-build.js to look like this:

var Angular2App = require('angular-cli/lib/broccoli/angular2-app');

module.exports = function(defaults) {
  return new Angular2App(defaults, {
    vendorNpmFiles: [
      'systemjs/dist/system-polyfills.js',
      'systemjs/dist/system.src.js',
      'zone.js/dist/**/*.+(js|js.map)',
      'es6-shim/es6-shim.js',
      'reflect-metadata/**/*.+(ts|js|js.map)',
      'rxjs/**/*.+(js|js.map)',
      '@angular/**/*.+(js|js.map)',
      'angular2-notifications/**/*.+(js|js.map)' // <------------------- this is the line I added
    ]
  });
};

2- In your src/system-config.ts add 'angular2-notifications': 'vendor/angular2-notifications' to your const map:any constant.
3- In your src/system-config.ts in the const packages:any constant add the following key-value pair:

const packages: any = {
  'angular2-notifications': {
    format: 'cjs',
    defaultExtension: 'js',
    main: 'components.js'
  },
};

4- Finally to use the classes of this lib, import it in your .ts files as usual.

For me this solved the 404 problem, but now I got another issue that is, the options of the notification, they are not working properly -_-

@flauc
Copy link
Owner

flauc commented Sep 29, 2016

Thank you @ashajjar 👍

@flauc flauc closed this as completed Sep 29, 2016
@jason0598647
Copy link

Is anyone able to get this working with angular2-seed project from here https://github.com/mgechev/angular-seed#configuration

I'm getting this error:
(SystemJS) XHR error (404 Not Found) loading http://localhost:5555/node_modules/angular2-notifications.js(…)

@tomlobato
Copy link

tomlobato commented Nov 23, 2016

@jseparovic +1
Tried all the suggestions here and others. Something`s broken with flauc/angular2-notifications and/or angular2-seed.

@shavindraSN
Copy link

For those who still have the issue, try to map as follows in system.config.js. It worked for me.

 map: {
    'angular2-notifications': 'npm:angular2-notifications'
 } 

instead of

map: {
  'angular2-notifications': 'node_modules/angular2-notifications/components.js'
} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants