Sobes.tech
Junior — Middle

Millised on peamised käsud, mida kasutatakse NPM pakettide halduriga töötamisel?

sobes.tech AI

Vastus AI-lt

NPM package management main commands:

  • npm init — initializes a new project by creating a package.json file.
  • npm install <package> or npm i <package> — installs a package and adds it to dependencies.
  • npm uninstall <package> — removes a package from the project.
  • npm update — updates installed packages to the latest versions.
  • npm run <script> — runs custom scripts defined in package.json.
  • npm list — displays a list of installed packages.
  • npm publish — publishes a package to the NPM registry.
  • npm cache clean — clears the NPM cache.

Example of installing and running a script:

npm install express
npm run start

These commands allow managing dependencies and automating tasks in Node.js projects.