PHP and Node.js are both used for the server side development and thus have become a competitor for each other. Below are some differences based on different parameters to understand the two and make decision between the two giants.
PHP and Node.js are both used for the server side development and thus have become a competitor for each other. Below are some differences based on different parameters to understand the two and make decision between the two giants.
Fetching packages
Commands changed in yarn after npm
COMMAND | NPM | YARN |
---|---|---|
Install dependencies | npm install | yarn |
Install package | npm install package_name npm install package_name@version_number | yarn add package_name yarn add package_name@version_number |
Uninstall package | npm uninstall package_name | yarn remove package_name |
Install dev package | npm install package_name –save-dev | yarn add package_name –dev |
Update dev package | npm update package_name npm update package_name@version_number | yarn upgrade package_name yarn upgrade package_name@version_number |
View package | npm view package_name | yarn info package_name |
Global install package | npm install -g package_name | yarn global add package_name |
Commands same for npm and yarn:
NPM | YARN |
---|---|
npm init | yarn init |
npm run [script] | yarn run [script] |
npm list | yarn list |
npm test | yarn test |
npm link | yarn link |
npm login or logout | yarn login or logout |
npm publish | yarn publish |