question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

when running via npx it uses the wrong path

See original GitHub issue
npx tsup ./src/index.ts --format esm,cjs,iife --dts --minify

Even after installing typescript it wouldn’t solve the issue, adding tsup to the current project and then trying with the local version fixed the issue.

Error: Cannot find module 'typescript'
Require stack:
- /Users/xo/.npm/_npx/96410/lib/node_modules/tsup/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.js
- /Users/xo/.npm/_npx/96410/lib/node_modules/tsup/dist/rollup.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/xo/.npm/_npx/96410/lib/node_modules/tsup/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.js:6:10)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
Emitted 'error' event on process instance at:
    at emitUnhandledRejectionOrErr (internal/event_target.js:543:11)
    at MessagePort.[nodejs.internal.kHybridDispatch] (internal/event_target.js:358:9)
    at MessagePort.exports.emitMessage (internal/per_context/messageport.js:18:26) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/xo/.npm/_npx/96410/lib/node_modules/tsup/node_modules/rollup-plugin-dts/dist/rollup-plugin-dts.js',
    '/Users/xo/.npm/_npx/96410/lib/node_modules/tsup/dist/rollup.js'
  ]
}

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
egoistcommented, Nov 25, 2021

So basically, you have to install tsup locally in order to use --dts flag. If not please provide a repo so I can take a look.

0reactions
unlightcommented, Dec 25, 2020

Can confirm the issue with npx, install tsup locally will solve the issue. Flag --no-save can be used (npm i tsup --no-save on CI/CD) to avoid modifying package.json

Read more comments on GitHub >

github_iconTop Results From Across the Web

when running via npx it uses the wrong path - Bountysource
Even after installing typescript it wouldn't solve the issue, adding tsup to the current project and then trying with the local version fixed ......
Read more >
npx not found, thought it is in the PATH - Stack Overflow
I'm setting up a local environment for the React Tutorial and I'm having some issues. What version of node do I have? $...
Read more >
Command Line Interface - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
NPX Create React APP Not Working - YouTube
But sometimes it throws error / exception. I can't install react using npx create-react-app and npx create react app not working for me....
Read more >
http-server - npm
Running on-demand: Using npx you can run the script without installing it first: npx http-server [path] [options] · Globally via npm. npm install ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found