`
leonzhx
  • 浏览: 793637 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论
阅读更多

 

1.  The Node Package Manager (NPM) allows you to easily manage modules in projects by downloading packages, resolving dependencies, running tests, and installing command-line utilities.

 

2.  NPM is a program written in Node.JS and shipped with the binary packages.

 

3.  If you compiled node from the source files, you want to install NPM as follows:

  $ curl http://npmjs.org/install.sh | sh

 

4.  The package.json file is the file that describes your project to both Node.JS and NPM. The only required fields are name and version. Normally, modules have dependencies, which is an object that references other projects by the name and version they defined in their package.json files.

 

5.  To tell Node which file to look for when someone calls require(‘my-project’) we can specify the main property in the package.json.

 

6.  To learn about all the possible properties for the package.json file, run:

  $ npm help json

  If you want to learn more about a certain NPM command, type npm help <command>.

 

7.  If you never intend to publish a certain project, add “private”: “true” to your package.json. This prevents accidental publication.

 

8.  Some projects distribute command-line tools that were written in Node. When that’s the case, you need to install them with the -g flag. If you want to distribute a script like this, include a flag “bin”: “./path/to/script” pointing to your executable script or binary when publishing.

 

9.  If you want to search for plugins related to realtime, for example, you would execute the following:

  $ npm search realtime

  This will search all the published modules that contain realtime in their name, tags, and description fields.

 

10.  Once you find a package that interests you, you can see its package.json and other properties related to the NPM registry by running npm view followed by the module name.

 

11.  npm install --save moduleA will automatically add moduleA as dependency to your package.json file.

 

12.Run npm update under your project folder, you will get your dependencies updated.

 

13.To change the location of global node module folder , add a line:

  prefix=PATH_OF_GLOBAL_MODULE 

  to ~/.npmrc file.

 

分享到:
评论

相关推荐

    Android.application.development

    Chapter 1. Overview Chapter 2. Environment Setup Chapter 3. Architecture Chapter 4. Application Components Chapter 5. Hello World Example Chapter 6. Resources Organizing & Accessing Chapter 7. ...

    Procedural.Content.Generation.for.Cplusplus.Game.Development

    Chapter 1. An Introduction to Procedural Generation Chapter 2. Project Setup and Breakdown Chapter 3. Using RNG with C++ Data Types Chapter 4. Procedurally Populating Game Environments Chapter 5. ...

    Raspberry.Pi.Computer.Architecture.Essentials.17843

    Introduction to the Raspberry Pi's Architecture and Setup Chapter 2. Programming on Raspbian Chapter 3. Low-Level Development with Assembly Language Chapter 4 USB 2.0 ports and 1 SoC on-board USB ...

    Odoo.10.Development.Essentials.epub

    Install Odoo from source code and use all the basic techniques to setup and manage your Odoo server instances Create your first Odoo application Add Odoo's social and messaging features to your own ...

    Android.Game.Programming.by.Example.1785280120

    The book begins by teaching you the setup of a game development environment on a fundamental level. Moving on, the book deals with concepts such as building a home screen UI, implementing game ...

    django2 by examples

    Chapter 1. Building a Blog Application Chapter 2. Enhancing Your Blog with Advanced Features Chapter 3. Extending Your Blog Application Chapter 4. Building a Social Website Chapter 5. Sharing Content ...

    Effective.Robotics.Programming.with.ROS.3rd.Ed.epub

    It also shows you how to use virtual machines and Docker containers to simplify the installation of Ubuntu and the ROS framework, so you can start working in an isolated and control environment ...

    Kali.Linux.Pentesting.Cookbook

    Chapter 1. Kali – An Introduction Chapter 2. Gathering Intel And Planning Attack Strategies Chapter 3. Vulnerability Assessment Chapter 4. Web App Exploitation – Beyond Owasp Top 10 Chapter 5. ...

    Building.VMware.Software-Defined.Data.Centers.epub

    Chapter 1. The Software-Defined Data Center Chapter 2. Identify Automation and Standardization Opportunities Chapter 3. VMware vSphere: The SDDC Foundation Chapter 4. SDDC Design Considerations ...

    CoreOS.Essentials.1785283944

    Chapter 1. CoreOS – Overview and Installation Chapter 2. Getting Started with etcd Chapter 3. Getting Started with systemd and fleet Chapter 4. Managing Clusters Chapter 5. Building a Development ...

    Beginning iOS Cloud and Database Development

    Chapter 1. Cloud Database Development: The Basics Chapter 2. Introduction to The Cloud Chapter 3. Applications for the Cloud Chapter 4. Basic Setup of iCloud and Key-Value Storage Chapter 5. iCloud ...

    Building.a.BeagleBone.Black.Super.Cluster.1783989440

    Chapter 1. BeagleBone Black System Board Chapter 2. Building a Beowulf Cluster Chapter 3. Operating System Setup and Configuration Chapter 4. Parallel Computing with OpenMPI and ScaLAPACK Chapter 5. ...

    Making Games with Python & PyGame.pdf(with code)

    Chapter 1 – Installing Python and Pygame ...................................................................................... 1 What You Should Know Before You Begin ..................................

    C.Programming.Language.The.ULtimate.Beginners.Guide

    In addition, we'll also teach you how to setup and use the Code Blocks IDE, which will help you greatly when programming in the C language. In this book you'll learn: Introduction to C Programming ...

Global site tag (gtag.js) - Google Analytics