Please provide us with the following information:
OS?
Windows 10
angular-cli: 1.0.0-beta.11-webpack.8
node: 6.4.0
os: win32 x64
I have created a project with Angular-cli. But my packagae.json is not updated with all the modules.
When I check in to git repository I have added node_modules content in the exclusion list so the files in the node_modules are not checked-in to the git repository. So if I clone my repository and run npm install it is not installing all the modules required because package.json doesn't contains all the required modules entries.
Question: When I create a new project with angular CLI how do I make sure it updates package.json file automatically ?
Also to fix this is theer an easy way to automatically update package.json my looking at all the modules in node_modules ? I tires npm init but it's not helping.
thanks you very much for your help.
Firstable, you are using a older version of Angular CLI (11, when newest is 16). Second, package.json does contain all the necessary dependencies that are installed with npm install normally. Which ones are you missing from there? Only problem I can think of, is that you have set _NODE_ENV_ to _production_ and you lack the devDependencies after npm install because of that. Please provide more information about what actually is missing.
Unless you are missing all the dependencies in devDependencies like Roope explained, this may be just a confusion about how NPM 3.x works.
In NPM 3.x, all dependencies are installed in local folder format, that's the ones directly linked from package.json, and also any child dependencies required for any of the directly linked ones.
For example, you might see angular-cli in your devDependencies, and no mention of webpack, but since angular-cli depends on webpack, you should find both folders directly under node_modules. This doesn't mean that webpack is missing from package.json, because it gets downloaded as part of downloading angular-cli.
Now, if you push the output of the ng new command, and then check it out in another folder, or if you run git clean -dfx on the root folder of the generated project, are you still able to run npm install, and then npm start runs successfully?
If yes, then angular-cli is doing its job well. If no, please open an issue with the specific error you get.
For the record, here are the test steps:
ng new test-project
cd test-project
git clean -dfx
npm install
npm start
Of course you should try this against beta-16. To ensure this you can run the following:
npm rm -g angular-cli
npm cache clear
npm install -g angular-cli
Awesome explanation by @Meligy, cheers!
Thank you very much for your detailed responses.
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
Unless you are missing all the dependencies in
devDependencieslike Roope explained, this may be just a confusion about how NPM 3.x works.In NPM 3.x, all dependencies are installed in local folder format, that's the ones directly linked from
package.json, and also any child dependencies required for any of the directly linked ones.For example, you might see
angular-cliin yourdevDependencies, and no mention ofwebpack, but sinceangular-clidepends onwebpack, you should find both folders directly undernode_modules. This doesn't mean thatwebpackis missing frompackage.json, because it gets downloaded as part of downloadingangular-cli.Now, if you push the output of the
ng newcommand, and then check it out in another folder, or if you rungit clean -dfxon the root folder of the generated project, are you still able to runnpm install, and thennpm startruns successfully?If yes, then
angular-cliis doing its job well. If no, please open an issue with the specific error you get.Please close this issue, and open a relevant issue if you get a particular error message from this scenario.
For the record, here are the test steps:
Of course you should try this against beta-16. To ensure this you can run the following: