0

I am working my way through building my first node.js app, with a mongodb backend. I didn't install any frameworks (like mean.io) but am just trying to build step by step so I understand what each component does etc.

So far, so good. My node js app exposes a GET method via express, and queries my mongdb. Right now it just dumps out a bunch of json data.

Now, I'd like to start working on the GUI. So I've been looking at angularjs. I've installed it using this command:

me@mydevbox:/var/www/html/node/inventory$ sudo npm install angularjs [email protected] /var/www/html/node/inventory └── [email protected]

When i check npm for an inventory of what's been installed, this is what I see: (this is just a partial list... to keep my question / post short and readable)

me@mydevbox:/var/www/html/node/inventory$ npm ls [email protected] /var/www/html/node/inventory ├── [email protected] extraneous ├─┬ [email protected] │ ├── [email protected] │ ├─┬ [email protected] │ │ ├── [email protected] │ │ └─┬ [email protected] │ │ ├── [email protected] │ │ └── [email protected] │ └─┬ [email protected] │ ├── [email protected] │ ├── [email protected] │ └── [email protected] ├─┬ [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├─┬ [email protected] │ │ └── [email protected] │ ├── [email protected] │ ├── [email protected] │ ├─┬ [email protected] │ │ ├── [email protected] │ │ ├── [email protected] │ │ └── [email protected] │ ├── [email protected] │ ├── [email protected] │ └── [email protected] ├─┬ [email protected] │ ├── [email protected] │ └── [email protected] └── [email protected] npm ERR! extraneous: [email protected] /var/www/html/node/inventory/node_modules/angularjs 

In reading other posts, some seemed to suggest it has to do with the user (eg. not using root) you install the package with. But that doesn't seem to be the problem here.

Questions

I'd like some help diagnosing this error that I'm seeing... Also once I have it installed properly, what's the best way to integrate angular into my existing node js application? The examples I've seen online talk about how to initialize a new app but that's not what I'm looking for.

Thanks!

2

1 Answer 1

1

npm ERR! extraneous means you didn't save the module in your package.json

Install again using --save

npm install angular --save 

(Also you installed angularjs instead of angular, I don't know the difference, but I would check it out)

The integration between the backend and the front in angular is made with services and the $http angular object.

I recommend you to do some angular tutorials, google has lots of them.

3
  • thanks. the --save worked. and yeah.. i've been trying some tutorials out as well. just was wondering if anyone had comments about if i had to "init" something to get angular integrated into my existing appCommentedAug 4, 2016 at 14:56
  • Would recommand you to make two separate projects. Name one "frontend" (With some frontend framework, Angular, React, etc), and another one, backend, with Node.js (Express will do the job for you). Then try to consume as suggested by tpsilva the services in Node.js using $http's angular object.CommentedAug 4, 2016 at 15:12
  • @Mathemagician Do MEAN stack applications have different project files ? I guess no .
    – WhoAmI
    CommentedJan 25, 2019 at 6:39

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.