I've seen some posts that refer to running npm with a -d argument. For example, this issue refers to doing npm -d install coffee-script. There are a few other pages that also refer to this syntax, including the install instructions for at least one npm package.
But I've been unable to find any documentation for this -d argument. The docs for npm install make no mention of -d, nor does the npm FAQ, nor do any of the other documentation pages I've looked through.
Does the -d option do anything? If so, what?
It's a shortcut for --loglevel info
See the Shorthands and Other CLI Niceties section:
-d: --loglevel info
Related
While studying Socket.io I encountered this npm command:
npm install -E socket.io-client#4.4.0
What does the -E tag mean?
npm documentation explains:
`-E, --save-exact`: Saved dependencies will be configured with an
exact version rather than using npm's default semver range
operator.
https://docs.npmjs.com/cli/v6/commands/npm-install
What does the -S flag for npm mean? I see it referenced here but https://docs.npmjs.com/cli/install does not cover what the -S is.
npm i -S #types/google-apps-script
-S is shorthand for --save, and it adds the package you're installing to the dependencies in your package.json file (which can be created with npm init). However, --save or -S is totally unnecessary if you're using npm 5 or above since it's done by default.
The 'S' option is the Save option in npm. It adds the npm package to your dependencies for your project. It's the same as --save.
I am installing some packages on NPM, sometimes I have to write -s and -g? What do they mean?
npm install -s socket.io
npm install -g xxxxxxx
npm -g <package> will install a package globally on your machine. Without the -g or --global flag, the package will be installed locally in the directory you were in when you ran the command.
npm -S <package> with an uppercase -S or --save will install the package and save it to your dependencies in your package.json, although I believe that is now the default behavior in current npm. I recommend reading the docs if you're unfamiliar with what's happening when you pass different options to npm.
#gmmetheny answered the question about the global -g flag, but -s appears to silence the output of the command (at least in npm v7.0.15).
In other words, including -s (or --silent) in your npm install command means that it will have no output (only a newline):
> npm install -s example-package1 example-package2
This may be useful for running the command in a script.
Running the command without the -s flag echoes information about what was installed, e.g.:
> npm install example-package1 example-package2
npm WARN deprecated some-pkg#1.2.3: this library is no longer supported
added 160 packages, and audited 160 packages in 6s
14 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
You can diff the resulting directories created after running each variant of the command and you can verify that the effects are the same.
As #Max mentioned, this option is NOT mentioned in the npm docs (at least not in any prevalent location where a user might find it after a reasonable amount of searching).
i was trying to run vuejs documentation offline (locally) and had no lack, it worked in the past but i don't know what i have done wrong.
i followed the steps on the following post
hear
basically the steps are
install hexo-cli globally
npm install hexo-cli --global
clone vuejs.org repository
git clone https://github.com/vuejs/vuejs.org.git
install project dependencies
cd vuejs.org && npm install
run local server using npm or hexo
npm start
i keep gett
FATAL Something's wrong. Maybe you can find the solution here: http://hexo.io/docs/troubleshooting.html
Error: watch /vuejs.org/themes/vue/layout/icons/ltc.ejs ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1374:19)
at Object.fs.watch (fs.js:1400:11)
at createFsWatchInstance (/vuejs.org/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/vuejs.org/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/vuejs.org/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleFile (/vuejs.org/node_modules/chokidar/lib/nodefs-handler.js:255:21)
at FSWatcher.<anonymous> (/vuejs.org/node_modules/chokidar/lib/nodefs-handler.js:473:21)
at FSReqWrap.oncomplete (fs.js:153:5)
You ran out of watchers. Proper solution would be to find out why that happened, however you can simply raise available amount of watchers.
fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
or remove files that are watched but aren't needed, for example some unused templates or assets.
You can find more options here:
Node.JS Error: ENOSPC
In #reactivex/rxjs package it is suggested that scoped package should be used:
npm install #reactivex/rxjs
And UMD module is available through npmcdn as
https://npmcdn.com/#reactivex/rxjs#5.0.0-beta.7/dist/global/Rx.umd.js
However, unscoped rxjs package has got published 5.x versions too but README also suggests
npm install #reactivex/rxjs
And UMD module is available as
https://npmcdn.com/rxjs#5.0.0-beta.7/bundles/Rx.umd.js
Both refer to git+ssh://git#github.com/ReactiveX/RxJS.git repository, but package contents look totally different.
Why do their trees differ so much? What is the practical difference between those two? Is there a reason why one of them should be favoured at this moment?
doubled check now and they appears to be the same file
$ wget https://npmcdn.com/rxjs#5.0.0-beta.7/bundles/Rx.umd.js -q -O rxjs
$ wget https://npmcdn.com/#reactivex/rxjs#5.0.0-beta.7/dist/global/Rx.umd.js -q -O reativx-rxjs
$ diff rxjs reativx-rxjs
$