ng2-table icon indicating copy to clipboard operation
ng2-table copied to clipboard

404 error

Open robinmaple opened this issue 9 years ago • 20 comments

import {NG_TABLE_DIRECTIVES} from 'ng2-table';

image

robinmaple avatar Apr 13 '16 12:04 robinmaple

image

robinmaple avatar Apr 13 '16 12:04 robinmaple

I installed with npm, and there is no compilation error but chrome console gives these error message and ng2-table won't load. Please help, thanks!

robinmaple avatar Apr 13 '16 14:04 robinmaple

try doing ng2-table/ng2-table

this is how i have done it so far and it seems to be working, this also depends on how its installed.

you could also try

node_modules/ng2-table/ng2-table

i am using the angular/angular2-seed setup and i only had to use ng2-table/ng2-table.

Destreyf avatar Apr 17 '16 07:04 Destreyf

Same problem here.

import {NG_TABLE_DIRECTIVES} from 'node_modules/ng2-table/ng2-table'; gives me an error in my editor (Atom): "Cannot find module 'node_modules/ng2-table/ng2-table'."

and import {NG_TABLE_DIRECTIVES} from 'ng2-table/ng2-table'; gives me this error in the browser: GET http://localhost:4200/ng2-table/ng2-table 404 (Not Found)

AndroidDoctorr avatar Apr 18 '16 21:04 AndroidDoctorr

Are you using systemjs? I've not seen this error so far with my testing but i have everything being bundled up by webpack.

Destreyf avatar Apr 18 '16 21:04 Destreyf

How do I tell? It's in node_modules, but I don't think I'm using it. Maybe?

AndroidDoctorr avatar Apr 18 '16 21:04 AndroidDoctorr

What does your index.html look like? This would give an easy way to check into it.

Destreyf avatar Apr 18 '16 21:04 Destreyf

Can you paste it in either a gist or directly on this issue wrapped in code tags so that we can see teh contents, github stripped the HTML out.

Destreyf avatar Apr 18 '16 21:04 Destreyf

<html> <head> <meta charset="utf-8"> <title>MyApp</title> <base href="/"> {{content-for 'head'}} <link rel="icon" type="image/x-icon" href="favicon.ico">

<link href="bootstrap.css" rel="stylesheet"> <link href="/css/theme.min.css" rel="stylesheet"> <link href="/css/myapp.css" rel="stylesheet"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css"> </head> <body> <myapp></myapp>

<script src="vendor/es6-shim/es6-shim.js"></script> <script src="vendor/systemjs/dist/system-polyfills.js"></script> <script src="vendor/angular2/bundles/angular2-polyfills.js"></script> <script src="vendor/systemjs/dist/system.src.js"></script> <script src="vendor/rxjs/bundles/Rx.js"></script>

<script src="jquery.js"></script> <script src="bootstrap.js"></script> <script src="ng2-bootstrap.js"></script>

<script src="vendor/angular2/bundles/angular2.dev.js"></script> <script src="vendor/angular2/bundles/http.dev.js"></script> <script src="vendor/angular2/bundles/router.dev.js"></script>

<script> System.config({ packages: { app: { format: 'register', defaultExtension: 'js' }, moment: { main: 'moment.js', type: 'cjs', defaultExtension: 'js' } } }); System.import('app.js').then(null, console.error.bind(console)); </script> </body> </html>

AndroidDoctorr avatar Apr 18 '16 21:04 AndroidDoctorr

import {PAGINATION_DIRECTIVES} from 'ng2-bootstrap/ng2-bootstrap'; is working, for reference

AndroidDoctorr avatar Apr 18 '16 21:04 AndroidDoctorr

So this issue comes from the fact that system.js does not know how to look up ng2-table.

This might help you get started on that front, in your code change the section that says "System.config" everything in side that script tag to this:

System.config({
    packages: {
        app: {
            format: 'register',
            defaultExtension: 'js'
        },
        moment: {
            main: 'moment.js',
            type: 'cjs',
            defaultExtension: 'js'
        }
    },
    map: {
        'ng2-table': 'node_modules/ng2-table'
    }
});

hopefully this helps you get your app running, if not, i highly suggest using a starter pack such as angular/angular2-seed and using its webpack server to compile everything during development to make life a little bit simpler.

Destreyf avatar Apr 18 '16 21:04 Destreyf

Aghh. I really thought that would do it...

Shouldn't it be looking there by default though? It finds ng2-bootstrap ok... I don't think a nuclear option is necessary, but anyway, I can't start over

AndroidDoctorr avatar Apr 18 '16 21:04 AndroidDoctorr

Any other ideas?

AndroidDoctorr avatar Apr 18 '16 22:04 AndroidDoctorr

This seems to be late but you need to add a mapping like, 'ng2-table': 'vendor/ng2-table' // ng2-table mapping and add // ng2-table dependency cliSystemConfigPackages['ng2-table'] = { main: 'ng2-table' }; to your package list.

Also, add 'ng2-table/**/*.js' // ng2-table in dist in your build file

adibalwani avatar May 23 '16 23:05 adibalwani

just extending Destreyf's comment. should add 'ng2-table':{ defaultExtension: 'js' } under packages section in systemjs.config.js

boopathyThangamani avatar Dec 23 '16 02:12 boopathyThangamani

I am getting this error: GET http://localhost:1337/node_modules/ng2-table/components/table/ng-table.component 404 (Not Found)

my system js has under map 'ng2-table/ng2-table' : 'node_modules/ng2-table/ng2-table.js' under packages: 'ng2-table': {defaultExtension: 'js'}

lcborn4 avatar Jan 19 '17 15:01 lcborn4

I am getting the same error as Icborn4. GET http://localhost:58933/node_modules/ng2-table/components/table/ng-table.component 404 (Not Found). But this is not the only file that can not be found. Actually all the required files in ng2-table.js can not be found.

I have installed ng2-table using npm. And this is what my configuration js filecontains: under map: ng2-table/ng2-table': 'node_modules/ng2-table/ng2-table.js' under packages: 'ng2-table': { defaultExtension: 'js' }

Thank you in advance

ancabica avatar Mar 14 '17 10:03 ancabica

Hi,

I started my project with the ng2 quick start seed, so I'm using SystemJS.

I did this way in System.config:

... paths: { 'npm:': '../node_modules/' }, map: { 'ng2-table': 'npm:ng2-table' }, packages: { 'ng2-table': { defaultExtension: 'js' } } ... In my application module:

... import { Ng2TableModule } from 'ng2-table/ng2-table'; ...

And finally, 404 errors disapeared.

I hope these can help you.

paulazabalegui avatar Mar 16 '17 20:03 paulazabalegui

Hi Paula,

Thank you. That fixed my problems.

ancabica avatar Mar 17 '17 07:03 ancabica

Thanks, Paula your reply kind of helped me too. I had to do the following

  1. In package.json ... "dependencies": { .... "ng2-table": "1.3.2"

  2. In Systemjs.config.js map: { .... 'ng2-table': 'node_modules/ng2-table' } packages: { .... , 'ng2-table': {defaultExtension: 'js' } }

  3. in my app.module.ts

import { Ng2TableModule } from 'ng2-table/ng2-table';

... @NgModule({ imports: [BrowserModule,.... , Ng2TableModule], .... })

  1. Then in my template <ng-table [config]="config" .... >

Got the ng2-table working in angular 4 environment, finally,

Also I have a gulpfile.js to do the copying...

LotusShiv avatar Aug 23 '17 01:08 LotusShiv