Just a newbie question, I am trying to install the Less
from Node.js
platform.
the command line is npm install -g less
. I check the doc from here
In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package.
What does it mean global package ? thanks.
The npm install installs all modules that are listed on package. json file and their dependencies. npm update updates all packages in the node_modules directory and their dependencies.
npm install (in package directory, no arguments): Install the dependencies in the local node_modules folder. In global mode (ie, with -g or --global appended to the command), it installs the current package context (ie, the current working directory) as a global package.
It helps with installing various packages and resolving their various dependencies. It greatly helps with your Node development. NPM helps you install the various modules you need for your web development and not just given you a whole bunch of features you might never need.
What is NPM? NPM is a package manager for Node. js packages, or modules if you like. www.npmjs.com hosts thousands of free packages to download and use. The NPM program is installed on your computer when you install Node.js.
You are not required to install Less as global, the Less ReadMe instruction is: npm install less
.
Installing it local, means the module will be available only for a project you installed it (the directory you were in, when ran npm install
).
Global install, instead puts the module into your Node.js path (OS dependent), and will be accessible from any project, without the need to install it separately for each.
See Diagram of Module look-up to understand how exactly modules are loaded when required by Node.js project.
In the end, I suggest you install it as global, as less is highly popular module, and you will very likely need it more than once.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With