Npm Install Flags

Active1 year, 8 months ago

Then npm update will install [email protected], because that is the highest-sorting version that satisfies ^0.4.0 (>= 0.4.0 npm update -g will apply the update action to each globally installed package that is outdated -- that is, has a version that is different from latest. Node-Flags This is a flags library for use with node.js. Flag definitions can be distributed across multiple files, as long as they are defined before flags.parse() is called. As with npm init, the npm install command has a flag or two that you'll find useful in your workflow - it'll save you time and effort with regard to your project's package.json file. When you're running npm install to install a module, you can add the optional flag --save to the command. I am about to install this npm package and it says npm install -D load-grunt-config, what does the -D flag do? Npm install takes 3 exclusive, optional flags which save or update the package version in your main package.json:-S, --save: Package will appear in your dependencies.-D, --save-dev: Package will appear in your devDependencies.-O, --save-optional: Package will appear in your optionalDependencies. This is a flags library for use with node.js.Flag definitions can be distributed across multiple files, as long as they are defined before flags.parse() is called.

How to install npm

This question already has an answer here:

  • npm installed packages are not accessible 1 answer

I am a beginner to Linux. I am using 14.04 Ubuntu. When I tried to install node I found a -g flag which says that if you install with it, it can be accessed globally.

So I tried to install nodejs and npm without typing -g flag in the command

I ran these commands Action essentials free download.

When I moved to the root folder using the cd command and checked npm --version and node --version it shows the corresponding versions.

So what's the need of the -g flag?

Oli
230k94 gold badges587 silver badges780 bronze badges
DILEEP THOMASDILEEP THOMAS

marked as duplicate by karel, Eric Carvalho, Charles Green, David Foerster, George UdosenDec 19 '17 at 18:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

The commands:

are for installing npm, and nodejs globally in your Ubuntu, but the -g flag is for installing npm packages globally for your development. That has nothing to do with apt-get command. To install an npm package to only a specific development folder you leave out the -g flag and that means you can only use that package in that dev folder.

George UdosenGeorge Udosen
23.9k11 gold badges56 silver badges81 bronze badges

Not the answer you're looking for? Browse other questions tagged command-lineaptnpm or ask your own question.

Active5 months ago

It looks like yarn does not pass node-gyp flags to native packages the way npm does.

For example when attempting to install sqlite3@3.1.6 with:

we get a successful installation of sqlite3 with sqlcipher extensions, due to passing --sqlite_libname and --sqlite, which are specified in sqlite3's binding.gyp.

But, when attempting to use yarn, and running what I would think to be the equivalent command, it looks like the flags aren't honored:

With npm unrecognized command line arguments are converted to gyp flags.

With yarn that doesn't seem to work.

Is there a way to get this functionality with yarn?

zealoushacker

Npm Install Flagstone

zealoushacker
3,9912 gold badges26 silver badges39 bronze badges

2 Answers

Yarn does not automatically expose -- arguments of install command to lifecycle scripts (pre/post/install scripts in package.json of dependencies).Here is the code where Yarn builds Env for the script execution https://github.com/yarnpkg/yarn/blob/master/src/util/execute-lifecycle-script.js#L39.

You can pass specific values via env setting in .yarnrc and also it builds npm_config_* settings based on .yarnrc/.npmrc configuration.

bestanderbestander

This is currently possible by using environment variables on the format npm_config_{snake_case_param}=true/false

Remote desktop client access licenses

Npm Install Flags

For example, npm install --build-from-source=true becomes:

It's documented here https://yarnpkg.com/lang/en/docs/envvars/#toc-npm-config

JCMJCM
6,4165 gold badges42 silver badges59 bronze badges

Not the answer you're looking for? Browse other questions tagged node.jsnpmnode-gypyarnpkg or ask your own question.