You're looking for
npm shrinkwrap
See the documentation here for more information.
It will generate an npm-shrinkwrap.json with the current versions, and it takes precedence over package.json, so you can delete that file and npm update if you wish.
UPDATE
Here is a little script that writes out the package.json with the versions from the npm-shrinkwrap.json to a new file, package-lockdown.json:
var fs = require('fs'); var p = JSON.parse( fs.readFileSync( 'package.json') ); var v = JSON.parse( fs.readFileSync( 'npm-shrinkwrap.json') ); updateDependencies( p.dependencies, v.dependencies ); updateDependencies( p.devDependencies, v.dependencies ); fs.writeFileSync( 'package-lockdown.json', JSON.stringify( p, null, 2 ) ); function updateDependencies( list, v ) { for ( var d in list ) list[d] = v[d].version; }
The above script updates devDependencies aswell, so be sure to either remove that line or run npm shrinkwrap --dev before running the script.