• Register
0 votes
191 views

Problem :

I am beginner to Angular 2. Currently I am trying to learn more about the server rendering with the help of Angular2, I am trying to use the gulp instead of webpack. But my problem is when my server starts then I start facing below error :

/Users/mphil/IdeaProjects/trails-angular2-isomorphic/node_modules/@angular/core/src/util/decorators.js:165
        throw 'reflect-metadata shim is required when using class decorators';
        ^
reflect-metadata shim is required when using class decorators

I have also tried some solutions mentioned online but they are not working on my code. How can I fix my code ?

8 4 2
2,300 points

Please log in or register to answer this question.

1 Answer

0 votes

Solution :

I was reading few questions and I came across your question here. I had also faced the similar issue recently. I can give you some solutions for your issue just check if they can fix your error as below.

You can try to add the import 'reflect-metadata'; to your server.ts file as it will help you in server rendering. After adding that small line of code my errors got fixed.

You can also try add the div tag. Similar to the directive the component HTML tag should be enclosed in the div tag as shown below

<div>
//html
</div>

When you will enclose your .HTML tag in div as shown above then your errors will be fixed.

5 2 1
4,980 points

Related questions

0 votes
1 answer 84 views
84 views
Problem: I am naive to Angular, Webpack, Bootstrap and typescript. I have tried to write a service but it is throwing the below error while my app is bootstrapping. I am currently using ng2 2.4.2 and the angular-cli 1.0.0-beta.24. My TypeError as below: &ldquo;Uncaught typeerror: ... .navigate(['/project', query]); } public extractData(res: Response) { let body = res.json(); return body || {}; } }
asked Sep 3, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 107 views
107 views
Problem: Recently I have joined the angular2 project. But now I am stuck with below listed errors. The errors occurred if I tried to send my JSON objects to my backend. It may be due a parsing of my JSON objects. I am very new to angualar so unable to find ... (core.umd.js:3971) at ZoneDelegate.invokeTask (zone.js:274) at Zone.runTask (zone.js:151) at XMLHttpRequest.ZoneTask.invoke (zone.js:345)
asked Aug 5, 2020 Raphael Pacheco 4.9k points
0 votes
1 answer 221 views
221 views
Problem : I am beginner to Angular. I have recently started to use the ng serve but now I continuously get below error. &ldquo;A bad http response code (404) was received when fetching the script.&rdquo; I have already tried to do lot of research on it but still I don&rsquo;t have any solution on it. Can somebody help me in resolving the errors ?
asked Mar 5, 2020 mphil 2.3k points
0 votes
1 answer 22 views
22 views
I was working on that but I got into some problems.
asked Dec 1, 2020 TeamScript 9.5k points
0 votes
1 answer 14 views
14 views
I am new to this. I just want to know how to do that?
asked Dec 1, 2020 TeamScript 9.5k points
0 votes
1 answer 74 views
74 views
Problem: I am getting following message when i run angualr2 program with typescript. angular is running in the development mode. call enableprodmode() to enable the production mode. What is the reason for this message is it a deployment option? Curious for feedback ?
asked Jul 16, 2020 quizzBabes 160 points
1 vote
1 answer 40 views
40 views
Problem: I have gained fundamental knowledge on Angular2. I am taking help of online tutorials to learn Angular2. I am trying to create the angular 2 App with the angular cli I have written below command in my cmd: npm install angular-cli -g After above command I am ... an error . I am unable to debug above error. I need Angular2 expert who can help me in fixing above Angular2 error for me.
asked Jun 5, 2020 Martin K 6.6k points