Package Exports
- install-local
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (install-local) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Install local
Installs npm/yarn packages locally without symlink. Exactly the same as your production installation, no compromises. Won't mess up your package.json.
Getting started
You can use install-local from command line or programmatically.
Command line:
$ install-local my-package my-dependant-package [my-dependant-package2, ...]From node:
const { installLocal } = require('install-local');
installLocal('my-package', 'my-dependant-package'/*, my-dependant-package2, ...*/)
.then(() => console.log('done'))
.catch(err => console.error(err));TypeScript types are also included
Why?
Why installing packages locally? There are a number of use cases.
- You want to test if the installation of your package results in expected behavior (test your .npmignore file, etc)
- You want to install a package locally in a lernajs-style monorepo
- You just want to test a fork of a dependency, after building it locally.
What's wrong with npm-link?
Well... nothing is wrong with npm link. It's just not covering all use cases.
For example, if your using typescript and you npm link a dependency from a parent directory, you might end up with infinite ts source files, resulting in an out-of-memory error:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memoryAn other reason is with npm link your not testing if your package actually installs correctly. You might have files in there that will not be there after installation.
Can't i use npm i file:?
You could use npm install file:.. versions of npm prior to version 5. It installed the package locally. Since version 5, the functionality changed to npm link instead. More info here: https://github.com/npm/npm/pull/15900
How to guarantee a production-like install
To guarantee the production-like installation of your dependency, install-local uses npm pack and [`npm install