This is a reproduction for a bug where ensurePackage
does not work with typescript
. Even after typescript
is installed, Node still cannot resolve it unless you re-run the script.
Steps
- Try
node index.js
and see that it fails the first time. - Call
node index.js
a second time and it works.
Note: if you remove
node_modules
first then the script works. It seems to be a problem whennode_modules
exist but typescript is not found.
Notes
moment
also fails.- If you try a different package it also works:
node index.js date-fns
. - If you remove the
require.resolve(pkg)
call then the script works the first time as well.