52780 (3) [Avatar] Offline
#1
On page 25 of the pdf (not the labeled page number, but the page number according to my PDF reader), there is the following code snippet:

<script>
System.config({
packages: {
'app': {defaultExtension: 'js'}
}
});
System.import('app/contact.spec')
.then(window.onload)
.catch(console.error.bind(console));
</script>


This code fails in Chrome with the following error: "Uncaught ReferenceError: System is not defined". Chrome's Dev Tool's error gives a stack trace that points to the line starting with
System.config
.

I tried following the setup process exactly, and this was the result. The versions of all of the javascript libraries (installed by npm) are different. I'm wondering if there are breaking changes that you need to fix, or if there are steps that the author took that are not mentioned in the current book (I'm reading v4 of the PDF).

It's kinda hard to use this book if the setup doesn't work. I'm off to other sources...
Jesse Palmer (37) [Avatar] Offline
#2
52780 wrote:On page 25 of the pdf (not the labeled page number, but the page number according to my PDF reader), there is the following code snippet:

<script>
System.config({
packages: {
'app': {defaultExtension: 'js'}
}
});
System.import('app/contact.spec')
.then(window.onload)
.catch(console.error.bind(console));
</script>


This code fails in Chrome with the following error: "Uncaught ReferenceError: System is not defined". Chrome's Dev Tool's error gives a stack trace that points to the line starting with
System.config
.

I tried following the setup process exactly, and this was the result. The versions of all of the javascript libraries (installed by npm) are different. I'm wondering if there are breaking changes that you need to fix, or if there are steps that the author took that are not mentioned in the current book (I'm reading v4 of the PDF).

It's kinda hard to use this book if the setup doesn't work. I'm off to other sources...


My apologies, yes there have been breaking changes. Looking back on it, I should have pinned the dependencies to specific versions inside the package.json file. I am in the process of rewriting those chapters after the final release of Angular. Chapter 4 should be up-to-date and Chapter 5 should be out in the next couple of weeks. I'll be updating the first couple of chapters as soon as possible. I sincerely apologize and thank you for your patience.
Jesse Palmer (37) [Avatar] Offline
#3
Until I can go back and update those chapters, there is a temporary fix. The application should work if you pin the dependencies to a specific version in the package.json file. For example, removing the carrot and changing "@types/hammerjs": "^2.0.32" to "@types/hammerjs": "2.0.32", will pin the dependency to a specific version.

If you do that for all of the dependenices in the package.json file, then run
"rm -rf node_modules" at the root of the project to get rid of the old dependencies, then "npm install" everything should work ok.

I realize this isn't ideal, but it's a short-term workaround. Let me know if you run into any issues. Thank you!

Jesse