deeleman / learning-angular2

Code samples repository for the examples provided in "Learning Angular 2", published by Packt Publishing - THE BOOK COVERS UP TO RC.1 and hence is severely OUTDATED. PLEASE REFER TO THE LATEST EDITIONS INSTEAD.
https://www.packtpub.com/web-development/learning-angular-2
108 stars 59 forks source link

Chapter 1 - cannot get install to work #43

Closed JudySchaner closed 7 years ago

JudySchaner commented 7 years ago

I copied the package.json file from this website, executed npm install and received the following errors:

c-7671:learning-angular2 judy.schaner$ npm install

chapter_01@1.0.0 preinstall /Users/judy.schaner/Angular2/learning-angular2 rm -rf ./built

chapter_01@1.0.0 postinstall /Users/judy.schaner/Angular2/learning-angular2 npm run typings install

chapter_01@1.0.0 typings /Users/judy.schaner/Angular2/learning-angular2 typings "install"

typings ERR! message Unable to resolve Typings dependencies typings ERR! caused by Unable to find "typings.json" from "/Users/judy.schaner/Angular2/learning-angular2"

typings ERR! cwd /Users/judy.schaner/Angular2/learning-angular2 typings ERR! system Darwin 16.0.0 typings ERR! command "/usr/local/bin/node" "/Users/judy.schaner/Angular2/learning-angular2/node_modules/.bin/typings" "install" typings ERR! node -v v4.5.0 typings ERR! typings -v 0.8.1

typings ERR! If you need help, you may report this error at: typings ERR! https://github.com/typings/typings/issues

npm ERR! Darwin 16.0.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "typings" "install" npm ERR! node v4.5.0 npm ERR! npm v3.10.8 npm ERR! code ELIFECYCLE npm ERR! chapter_01@1.0.0 typings: typings "install" npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the chapter_01@1.0.0 typings script 'typings "install"'. 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 chapter_01 package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! typings "install" npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs chapter_01 npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls chapter_01 npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /Users/judy.schaner/Angular2/learning-angular2/npm-debug.log

npm WARN chapter_01@1.0.0 No license field. npm ERR! Darwin 16.0.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" npm ERR! node v4.5.0 npm ERR! npm v3.10.8 npm ERR! code ELIFECYCLE npm ERR! chapter_01@1.0.0 postinstall: npm run typings install npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the chapter_01@1.0.0 postinstall script 'npm run typings install'. 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 chapter_01 package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! npm run typings install npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs chapter_01 npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls chapter_01 npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request: npm ERR! /Users/judy.schaner/Angular2/learning-angular2/npm-debug.log c-7671:learning-angular2 judy.schaner$

deeleman commented 7 years ago

The error message clearly states that your project lacks the typings manifest required by the npm client when installing the TypeScript typing definition files upon executing the postinstall script.

In order to workaround this issue, please save this file in your workspace and try running npm i again.

All in all, I'm really sorry to inform you that "Learning Angular 2" is too outdated already. The book was published when Angular 2 hit RC.1 back in May'16 in the hopes that the Angular framework would not contain breaking changes from that moment on. It turns out that such version tagging was more of an experiment conducted by the Angular 2 team and the framework still feature continuous breaking changes until its final release. While the book still provides an accurate picture of the framework philosophy, I'm afraid the API describe in its pages does not stay relevant anymore.

tblnx commented 7 years ago

Op 12-11-16 om 23:17 schreef Pablo Deeleman:

The error message clearly states that your project lacks the required by the |npm| client when installing the TypeScript typing definition files upon executing the |postinstall| script.

In order to workaround this issue, please save this file https://github.com/deeleman/learning-angular2/blob/master/chapter_01/typings.json in your workspace and try running |npm i| again.

All in all, I'm really sorry to inform you that "Learning Angular 2" is too outdated already. The book was published when Angular 2 hit RC.1 back in May'16 in the hopes that the Angular framework would not contain breaking changes from that moment on. It turns out that such version tagging was more of an experiment conducted by the Angular 2 team and the framework still feature continuous breaking changes until its final release. While the book still provides an accurate picture of the framework philosophy, I'm afraid the API describe in its pages does not stay relevant anymore.

Still, upgrading the code may help to see how you should do it now. The book is good for understanding the framework and the uptodate code may show the changes. It's better han nothing I think. Apart from the navbar css I could use Angular-Cli to get chapter 1 working. Bootstrap would not install and a copy of the css files only worked partially, but maybe I did something wrong.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/deeleman/learning-angular2/issues/43#issuecomment-260152254, or mute the thread https://github.com/notifications/unsubscribe-auth/APR39HWEb2cz8xxL1Qi9ONY0DVVVUju7ks5q9jsFgaJpZM4KwHmW.

deeleman commented 7 years ago

Please refer then to this branch/folder: https://github.com/deeleman/learning-angular2/tree/v2.1.2/chapter_01

Folder chapter_01 in branch v2.1.2 is fully up to date with the latest Angular edition, and hopefully will be in help for those now diving into Angular 2. Chapters 3-10 will be released soon.

For the record, and following current design patterns in the Angular 2 arena, the required typings are no longer installed through the typings CLI; but as npm dependencies instead.

Hope this helps.