Anything that can be loaded with require(...) in a Node.js program
A text file in json format that describes your "package" and it's dependencies.
npm init
npm i <pgk>
code & test
npm shrinkwrap
git clone
npm install
Publish
Deploy
?
npm init
npm i <pgk>
code & test
npm shrinkwrap
git clone
npm install
Publish
Deploy
?
Ramp Up
New blank project
Existing project
npm init
npm i <pgk>
code & test
npm shrinkwrap
git clone
npm install
Publish
Deploy
?
Develop
npm init
npm i <pgk>
code & test
npm shrinkwrap
git clone
npm install
Publish
Deploy
?
Publish/Deploy
npm init
npm i <pgk>
code & test
npm shrinkwrap
git clone
npm install
Publish
Deploy
?
Ramp Up - Blank Project
$ npm init --yes
Wrote to my-project/package.json:
{
"name": "my-project",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "Bruce Campbell <bruce@ldschurch.org>",
"license": "ISC"
}
$ ls
package.json
$
npm init
npm i <pgk>
code & test
npm shrinkwrap
git clone
npm install
Publish
Deploy
?
Ramp Up - Existing Project or Generated Project
Use npm install to download project dependencies from the registry
npm init
npm i <pgk>
code & test
npm shrinkwrap
git clone
npm install
Publish
Deploy
?
Develop
npm init
npm i <pgk>
code & test
npm shrinkwrap
git clone
npm install
Publish
Deploy
?
Publish/Deploy
1.2.3
http://semver.org/
https://github.com/npm/node-semver
major - breaking changes
minor - new features but compatible
patch - backwards compatible bug fixes
major
minor
patch
The dependencies sections of package.json specifies the name and a version string for each dependency
"dependencies": {
"compression": "^1.5.2",
"cookie-parser": "^1.3.5",
"dotenv": "^2.0.0",
"express": "^4.13.3",
...
}
Do you get errors installing packages globally?
https://docs.npmjs.com/getting-started/fixing-npm-permissions
sudo chown -R $USER $(npm config get prefix)/lib/node_modules
In theory, malicious code could spread
through the npm ecosystem because
Both are WIP
Hydra Worm Disclosure: http://tinyurl.com/h6cbwhu
npm response: http://tinyurl.com/hujcz85