02 Package.json - biswajitsundara/Protractor GitHub Wiki
The package.json file in angular projects is like the pom.xml in maven projects. It contains dependencies, project properties, description, author, scripts etc.
- Open blank folder in visual studio editor
- Go to terminal and type
npm initto createpackage.json - Here we can specify all the dependencies the project needs to download
- It will ask some details like package name, version etc. Just keep pressing enter
- Finally is this ok? say yes.
- Go to terminal and run the command
npm install protractor - it will add protractor dependencies to package.json
- but we can't do this for all the dependencies
- so just add all the dependencies. and then type
npm install
- Check the protractor type script example https://github.com/angular/protractor/tree/5.4.1/exampleTypescript
- Open the file package.json
- Copy the dependencies to the file we have created.
- Run the command
npm install - When the command is issued, it goes to package.json file ->dependencies section and downloads everything.
By default jasmine doesn't understand typescript, so we are adding these two dependencies
"@types/jasmine": "2.5.41", "@types/jasminewd2": "^2.0.0",
whenever we see something like @types/ that means we are adding some support for Typescript
- Once the
npm installcommand is completed. It will create a new foldernode_modulesand put all the dependencies in this folder - Please note all the installed dependencies are local to the project.
- Means if we create another project then we need to create another
package.jsonfile & runnpm install - If anything goes wrong then delete this
node_modulesfolder & then run thenpm installagain