Is package.json supposed to be manually edited? Couldn\'t a program like npm just look through the files, see the \"require\" statements, and then use that to put the necess
Command line:
npm init
will create package.json file
To install , update and uninstall packages under dependencies into package.json file:
Command line :
npm install <pkg>@* --save
will automatically add the latest version for the package under dependencies into package.json file
EX:
npm install node-markdown@* --save
Command line:
npm install <pkg> --save
also will automatically add the latest version for the package under dependencies into package.json file
if you need specific version for a package use this Command line:
npm install <pkg>@<version> --save
will automatically add specific version of package under dependencies into package.json file
EX:
npm install koa-views@1.0.0 --save
if you need specific range of version for a package use this Command line:
npm install <pkg>@<version range>
will automatically add the latest version for the package between range of version under dependencies into package.json file
EX:
npm install koa-views@">1.0.0 <1.2.0" --save
For more details about how to write version for package npm Doc
Command line:
npm update --save
will update packages into package.json file and will automatically add updated version for all packages under dependencies into package.json file
Command line:
npm uninstall <pkg> --save
will automatically remove package from dependencies into package.json file and remove package from node_module folder
You can now use Yeoman - Modern Web App Scaffolding Tool on node terminal using 3 easy steps.
First, you'll need to install yo and other required tools:
$ npm install -g yo bower grunt-cli gulp
To scaffold a web application, install the generator-webapp generator:
$ npm install -g generator-webapp // create scaffolding
Run yo and... you are all done:
$ yo webapp // create scaffolding
Yeoman can write boilerplate code for your entire web application or Controllers and Models. It can fire up a live-preview web server for edits and compile; not just that you can also run your unit tests, minimize and concatenate your code, optimize images, and more...
Yeoman (yo) - scaffolding tool that offers an ecosystem of framework-specific scaffolds, called generators, that can be used to perform some of the tedious tasks mentioned earlier.
Grunt / gulp - used to build, preview, and test your project.
Bower - is used for dependency management, so that you no longer have to manually download your front-end libraries.
Based on Pylinux's answer, below is a solution for Windows OS,
dir node_modules > abc.txt
FOR /F %k in (abc.txt) DO npm install --save
Hope it helps.
First off, run
npm init
...will ask you a few questions (read this first) about your project/package and then generate a package.json file for you.
Then, once you have a package.json file, use
npm install <pkg> --save
or
npm install <pkg> --save-dev
...to install a dependency and automatically append it to your package.json
's dependencies
list.
(Note: You may need to manually tweak the version ranges for your dependencies.)