Skip to content

Instantly share code, notes, and snippets.

@silversonicaxel
Last active August 6, 2018 16:27
Show Gist options
  • Select an option

  • Save silversonicaxel/77a1a897ca70d83ad965 to your computer and use it in GitHub Desktop.

Select an option

Save silversonicaxel/77a1a897ca70d83ad965 to your computer and use it in GitHub Desktop.
NODE #node #nodejs #packagejson
// create a package.json file asking for
// - name (node)
// - version (1.0.0)
// - description ()
// - author ()
npm init
// version of npm installed
npm -v
// update version of npm
npm install npm -g
// look for package.json and install modules
npm install
// install the node package locally into the machine, it will be executable with package.json bin parameter
npm install -g
//install module globally
npm install <module> -g
//install module in the current directory
npm install <module>
//install module and save it to the package.json dependencies
npm install --save <module>
//install module and save it to the package.json devDependencies
npm install --save-dev <module>
//delete module from package.json and node_modlues/
npm uninstall <module>
//search module name into the repository
npm search <module>
//list of global node modules installed
npm list --global
npm list --global --depth=0
//cleaning cache of node (because node the first time it installs a module, it keeps locally a copy of it, specifically that version)
npm cache clean
// login in npm registry with username, password and public email
npm login
// publish or update in npm registries an npm package
npm publish
{
"name": "Application",
"version": "1",
"description": "Description",
"author": "Author",
"dependencies": {
"module1": "latest",
"module2": "1.8.7",
"module3": "~1",
"module4": "~1.8",
"module5": "~1.8.7"
}
}
"module1": "latest", # latest version from github repository
"module2": "1.8.7", # major version . minor version . patch version
"module3": "~1", # 1.0.0 <= version < 2.0.0
"module4": "~1.8", # 1.8.7 <= version < 1.9.0
"module5": "~1.8.7" # 1.8.7 <= version < 1.9.0 safe version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment