🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)
🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)

🔧 Programmierung 🕛 kürzlich 3 Min Lesezeit
0

npm and everything you need to know about the package.json

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht




What is npm?



npm is a package manager for NodeJS. It is also the largest single language code repository on earth and a tool for installing and managing packages from the repository on the command line.






What is a package?



The npm registry consists of numerous packages or libraries that can be downloaded, installed, and used as a dependency in a NodeJS project. An npm package is a reusable piece of code published to the npm registry. It helps developers improve their workflow by incorporating functionality, thereby reducing the need to write redundant or repetitive code.






How do I install a package in my NodeJS project?



By using the CLI command npm install





  • npm install: This command will install all the dependencies mentioned in the package.json in the node_modules folder.


  • npm install <package-name>: Installs the package in the current project directory (inside the node_modules folder). The package is accessible only within that project.


  • npm install -g <package-name>: Installs the package system-wide, making it available from anywhere on your machine.


  • npm install <package-name>@<version-number>: Installs a specific version of that package.


  • npm install <package-name> --save-dev: Installs the package and puts it in the devDependencies block of package.json


  • npm install <package-name> --no-save: Installs the package but does not add the entry to the package.json file dependencies.


  • npm install <package-name> --save-optional: Installs the package and adds the entry to the package.json file's optionalDependencies


  • npm install <package-name> --no-optional: This will prevent the installation of optional dependencies.






What is package.json?



package.json is a configuration file used in Node.js projects to manage project metadata, dependencies, and scripts. It acts as the heart of a NodeJS project.






What is the difference between devDependencies and peerDependencies?



devDependencies: These are packages and libraries needed only during development or testing. They are not included in the production code.



Installation:



npm install tslint --save-dev



peerDependencies: These are dependencies that the project needs to work on, but it expects the user who is installing the package to provide the dependency.




CODE
"peerDependencies": {
"graphql": ">=10.0.0"
}






The above block means:




  • The project needs the package graphql to work.

  • It needs the version of the graphql package to be 10.0.0 or higher.

  • The package users must install GraphQL themselves.






Scripts in package.json



The scripts field in package.json defines commands that can be run using npm run <script-name>. Some scripts worth mentioning:



start: The command to start the application.




CODE
"start": "node index.js"






build: Used for production builds.




CODE
"build": "webpack --mode production"






test: Runs the unit test suite.




CODE
"test": "nyc"






dev: Starts the development server.




CODE
"dev": "nodemon index.js"






lint: Runs a linter to check code quality.




CODE
"lint": "tslint ."






clean: Cleans up build artefacts.




CODE
"clean": "rm -rf dist"






compile: Used to transpile source code into a different format (e.g., TypeScript to JavaScript)




CODE
"compile": "tsc"






publish: Used to publish the package to a registry like npm.




CODE
"publish": "npm publish"







  • Pre/Post Hooks: There are also pre/post hooks for scripts like preinstall, postinstall, prebuild, precompile, postpublish etc.


  • Custom scripts: Custom scripts can also be written in the package.json and can be just run using npm run <script-name>


Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Hackers Just Poisoned the Rust Supply Chain | Threat Wire
1 Quelle
Hackers Found a Way Into Humanoid Robots | Threat Wire
1 Quelle
Bits und so #1021 (Passwort für Laufwerk)
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten npm and everything you need to know about the package.json

Thematisch verwandte Begriffe: everything, need, know, about · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...