npm/npm#17929 still occurs in npm 5.4.1 - private packages on the local disk are deleted whenever npm is used.
If npm fixes this in future great, but in the meantime, for others having the issue, if you're using monorepo / modules everywhere:
-
Install yarn and run
yarn config set workspaces-experimental true
-
Move your private packages to
/packages
-
Add a yarn workspace to your
package.json
with:"workspaces": [ "packages/*" ],
-
Delete
npm-shrinkwrap.js
and/orpackage-lock.json
-
Remove any hacks you were doing to restore the packages deleted by npm in your deploy tools
-
Change
npm install
toyarn
in your deploy tools