Lockdown
Make sure you're in the loopback project directory:
If not, then get in there:
Its easy to let the flexible versioning notations (
*
,~
or^
) inpackage.json
fool us into working against different versions of dependencies! Since features and bugs vary across versions, let us make sure to work with precisely defined versions for all dependencies.The
package.json
file is lenient and uses the^
symbol to let you install anything newer than the listed version. For example, the currentpackage.json
file which was generated byslc
and it contains:but if you inspect what was installed (when
npm install
auto ran as part of project setup) you'll see much newer versions:Now let's freeze the versions so any development or deployments in the future will use these installed versions and nothing else:
A new file is produced. Examine npm-shrinkwrap.json and you will see a much more explicit file that tracks the versions of every dependency and sub-dependency etc. As long as you leave this file in your project and preferably check it into your source control repository, you can expect consistent behavior across developers and deployments. From now on whenever
npm install
is run, it will ignore the wishy-washypackage.json
and instead pay attention tonpm-shrinkwrap.json
Good deal! onwards and upwards...
Last updated