The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

Tachyon80 (9) [Avatar] Offline
I am new to Node.js and AngularJS. I'm trying to learn it with this book but I can't understand the environment I have to set up to get started. I started by following the steps in appendix B "Setting up a Node.js server". I think I did ok there. I stopped after Initialize the repo.

Then I went to page 9 and tried to follow the bullet points. The first one I'm pretty sure I did already. The second step is:
npm install -g serve
I don't think that worked. My Mac Terminal program had many lines that started with "npm ERR!" The file npm-debug.log was created and I've attached it to this post.
1) What went wrong? How do I fix it?
2) "Install the serve package" is installing something that makes the Node.js server run local on my computer? Or is it just running the server that's already installed?

I'd really like to get started with AngularJS but I just don't understand how to get past these problems. Any help would be greatly appreciated.
Lukas Ruebbelke (107) [Avatar] Offline
Try running the command in sudo mode i.e.
sudo npm install -g serve
. Let me know if that doesn't work.
Tachyon80 (9) [Avatar] Offline
It worked. Thank you so much. I finished all the bullet points on page 9 and I'm seeing the application run on my browser with url: http://localhost:3000/
So, each day after turning on my computer I need to open Terminal and do the "serve" command in the folder of whatever AngularJS application I'm working on?
Lukas Ruebbelke (107) [Avatar] Offline
We are just using the serve module to provide a lightweight HTTP server so that you can view the app in the browser over HTTP instead of the local file system. There are a few other alternatives to this, but serve is the easiest one that I have found. I generally run all my projects this way unless there is some server-side technology such as rails that is providing it for me.
372567 (12) [Avatar] Offline
I have two directories angello and angello-lite where I have cloned sw from gitHub.

Initially, I cd'ed to angello, installed serve and then served client as mentioned in the book. This worked.

I then cd'ed to angello-lite, and then served as mentioned in the book.I got a 404 error. I installed serve in this directory also and then was able to serve the app.

Why do I have to install serve in both angello and angello-lite? Why wouldn't the serve in angello work for angello-lite?

I realize that this is not an angularJS question but a server question.

Lukas Ruebbelke (107) [Avatar] Offline
I generally install serve as a global npm module via

npm install -g serve

This way I can run serve from anywhere. Occasionally, it makes sense to run an npm module local to the project if for instance, you need to target a specific version. If you did not install with the -g flag then it will just install it locally to your project and you will have to do it for each one.

Does this make sense? Happy to elaborate further if you would like!
372567 (12) [Avatar] Offline
Thanks for your reply.

I did install it as follows on the first directory. (I went back and checked by using the down arrow to look at the previous commands.)

npm install -g serve

So, I don't know what happened. I have other things to worry about at the moment, such as Angello-Helper, and won't worry about this. smilie

At the moment, I am able to serve from any directory. Some of the directories of course may not have the expected files. However, serve works.

$ cd vendor
$ serve
serving c:\Users\shaker.chandrasekhar\angello\client\vendor on port 3000
eheb (2) [Avatar] Offline
with firebase back-end, in login screen of Angello, with sign up button : i fill my mail as login adn a new password.
=> Sign Up 'Ther was a error processing the signup'
in console, get : XMLHttpRequest cannot load No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9080' is therefore not allowed access.
manngs (15) [Avatar] Offline
My Angello installation hangs on the opening page
I have downloaded the Angello code from Git and run npm to set up the Node.js server. When I go to localhost:3000, the front page appears (including the To Do, In Progress and other headers) but the spinning circle appears in the middle of the screen, and it stays there permanently. I have waited for half an hour but it never finishes. I attach a screen capture. What could be causing this problem and how do I fix it?
manngs (15) [Avatar] Offline
I cannot get the Node server to work as described in Appendix B. I have installed Node.js, and created the angello-express-api directory from the Github clone, but when a run the "node server.js" command I always get the following error message:

C:\Angular JS in Action\angello-express-api>node server.js
throw err;

Error: Cannot find module 'mongodb/node_modules/bson'
at Function.Module._resolveFilename (module.js:326:15)
at Function.Module._load (module.js:277:25)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Angular JS in Action\angello-express-api\node_modu
at Module._compile (module.js:398:26)
at Object.Module._extensions..js (module.js:405:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)

This suggests something is wrong with my npm setup, but I have already tried reinstalling it. I need to know what this error message means and how to fix it.

I am finding this very annoying. I have a live application for which I want to use Angular JS, but I do not intend to use any of Node.js, MongoDB or Git in the application. The book's publicity does not mention any of these topics as being required prerequisites for its material. So my learning is being held up by topics which are not part of the book's title, when I urgently need to be learning its main content.
manngs (15) [Avatar] Offline
As a follow-on to my previous post, I did an npm install bson and an npm install mongodb in the angello-express-api directory, and copied the directories so that a directory mongodb/node_modules/bson does exist. This allows the angello-express-api server to run. However, when I try to run angello to access it, it still gives the hung entry page. The console gives the attached output, which suggests that mongodb or mongoose is not reading the login credentials correctly.

It may be that I am doing wrong to create bson and mongodb directories and copy them. I assume that the credentials in the .env file must be correct. Is this another symptom of my earlier problem?