NPM Commands for ReactJS..

 

What is npm?


NPM stands for Node Package Manager and it is the package manager for the Node JavaScript platform. It put modules in place so that node can find them, and manages dependency conflicts intelligently. Most commonly, it is used to publish, discover, install, and develop node programs.


Package.json

Package name - 
If you plan to publish your package, the most important things in your package.json are the name and version fields as they will be required. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version. If you don`t plan to publish your package, the name and version fields are optional.

Rules :

  • The name must be less than or equal to 2014 characters. This includes the scope for scope packages
  • The name can`t start with a dot or an unerscore
  • New packages must not have uppercase letters in the name
  • The  name ends up being part of a RUL, an argument on the command line, and a folder name therefore, the name can`t contain any non-URL - safe characters.
  • Version- If you plan to publish your package, the most important things in your package.json are the name and version fields as they will be required.Then name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version. If you don`t pla to publish your package, the name and version fields are optional.
  • Description- it s a string. This helps people discover your package, as it`s listed in npm search.
  • Entry point- wee write file which includes the main logic of package/ module.
  • Test command - write test tool name
  • Git repository - Address of git repo
  • Keywords - Its an array of strings.This helps people discover your package as its listed in npm search.
  • Author - Name of Author
  • License - You should specify a license for your package so that people know how they are permitted to use it and any restrictions you`re placing on it. 

npm commands

  •  npm -v                      
     
    It displays the npm version installed on your system.

  •  npm list     / ls
    It lists the versions and name of all dependencies in the current
    directory.

  • npm outdated -g
  • find out the versions of pacakges..

  • npm help  
  • To get full detailed list of all the components

  • sudo npm install npm@latest
  • To install latest version of Node Package Manager

  • npm i packagename 
  • To install a package for a development

  • npm remove packagename
  • To remove package name from package.json / and from node_modules

  • npx yarn package
  • To install Yarn

  • NODE JS Command Line Interfaces

  • npm init     
  • To create a package.json in interactive mode

  • npm i node_practice
  • To install node modules

  • npm i http
  • To install package-log.json

  • npm start     
  • To start a package

  • npm doctor    
  • To check your environment 

  • npm install
  • To install dependencie pakages

    VSCode Command Line Interfaces

  • Code .
  • To redirect into VS Code editor

  • git clone fileName
  • To clone git url into another folder

  • npm view react version
  • To find react version
  • - OR -
  • in the node_modules folder. So, to check the React Version, we need to go to the node_modules/react/cjs/react.development.js file.

  • npm install react@18 react-dom@18
    To upgrade your react version



      More NPM Commands