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 init to create package.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.

Update Manually

  • 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

Install Dependencies

Note

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

node_modules

  • Once the npm install command is completed. It will create a new folder node_modules and 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.json file & run npm install
  • If anything goes wrong then delete this node_modules folder & then run the npm install again
⚠️ **GitHub.com Fallback** ⚠️