1

Recently I set up my first project in Angular2 on Ubuntu with few simple steps:

Prep:

apt-get install nodejs
npm install -g typescript
npm install -g angular-cli

Start project

ng new app-name
cd app-name
ng serve

That pretty much worked for me. I was learning the Angular, developing the app and pushing my code to github. During that I installed two more dependencies. Then I reinstalled my whole computer and cloned my code from github and here is where problems started. After preparing environment again lots of dependencies are missing, deprecated or are missing even though they are installed on my machine.

After two days of googling I'm with not working project.

Is there a way of maintaining project and it's dependencies' list like for example virtual env with Python? What are the good practices to keep project in order, store the informations about dependencies, just keep everything clear?

1 Answer 1

2

If you use npm package manager in your project (which you probably do, because you used angular-cli), then the package.json file is responsible for maintaining your dependencies.

Every time you install a dependency using npm install you should make sure it is saved to your package.json file's dependencies (or dev dependencies) using the flag --save (or --save-dev).
For example: npm install moment --save.

After you clone your project, just run npm install in the project's directory, and everything should work properly.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.