Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI's package.json missing script to auto-install dependencies after CLI installation #964

Closed
rlin415 opened this issue Mar 5, 2021 · 2 comments · Fixed by #993
Closed
Assignees
Labels
bug Unwanted or unintended logic causing harm help wanted Open source contributions actively sought

Comments

@rlin415
Copy link

rlin415 commented Mar 5, 2021

Describe the bug
After running npm install -g @stacks/cli, I tried using the stx command which failed with this error message:

internal/modules/cjs/loader.js:803
    throw err;
    ^

Error: Cannot find module 'typescript

I had to manually run npm i inside the CLI package to resolve the error.
What version of Blockstack.js are you using?
v1.2.4
Is the bug present in the Blockstack CLI, Gaia hub, Connect or Blockstack Browser?
Blockstack CLI
To Reproduce
Steps to reproduce the behavior:

  1. Run npm install -g @stacks/cli
  2. Run stx

Expected behavior
stx runs with no issues after installing stacks CLI.

Console log

internal/modules/cjs/loader.js:803
    throw err;
    ^

Error: Cannot find module 'typescript

Desktop (please complete the following information):

  • OS: MacOS Big Sur v11.1
@rlin415 rlin415 changed the title Package.json missing script to auto-install dependencies after installing package CLI's package.json missing script to auto-install dependencies after CLI installation Mar 5, 2021
@zone117x zone117x added bug Unwanted or unintended logic causing harm P2 help wanted Open source contributions actively sought labels Mar 18, 2021
@marcosc90 marcosc90 self-assigned this Mar 30, 2021
@marcosc90
Copy link
Contributor

marcosc90 commented Mar 31, 2021

There are two one possible solution:

  1. add typescript to @stacks/cli dependencies:

You'll need to install typescript locally since v8, it's using require.resolve which has its own separate limitations but is used to resolve a different issue. That means typescript is resolved from where you're running it right now.

See: TypeStrong/ts-node#707 (comment)

  1. bump ts-node to 9.y.z

This is most likely the way to go, but I have to check that everything still works after a major version bump.

I'm working on this

@marcosc90
Copy link
Contributor

ts-node has typescript as a peerDependency, and peer dependencies are not installed by default from NPM v3-v6. NPM 7 reintroduced the automatic installation of peer dependencies.

The issue is no longer present on the latest NPM version. To fix it for those using older versions of NPM, listing typescript as a dependency is the only solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Unwanted or unintended logic causing harm help wanted Open source contributions actively sought
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants