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

ts-node cannot find typescript module on npx after version up #764

Closed
hojin-choi opened this issue Jan 23, 2019 · 2 comments
Closed

ts-node cannot find typescript module on npx after version up #764

hojin-choi opened this issue Jan 23, 2019 · 2 comments

Comments

@hojin-choi
Copy link

I'm using ts-node on npx for a small program.

$ npx -p ts-node -p typescript ts-node sample.ts

However, this command is not working and prints error message after ts-node version up from 7.0.x to 8.0.x.

Error: Cannot find module 'typescript'
    at Function.Module._resolveFilename (module.js:548:15)
    at Function.resolve (internal/module.js:18:19)
    at Object.register (/Users/hojinchoi/.npm/_npx/9027/lib/node_modules/ts-node/src/index.ts:208:28)
    at Object.<anonymous> (/Users/hojinchoi/.npm/_npx/9027/lib/node_modules/ts-node/src/bin.ts:108:17)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)

I tried to specify ts-node version and it's working well.

$ npx -p [email protected] -p typescript ts-node sample.ts

So I think it's a bug after version up.

@blakeembrey
Copy link
Member

I don't think this is a bug, just a change. Do you have typescript installed locally? It resolves according to CWD now instead of a global compiler instance. This is because of #697.

@hojin-choi
Copy link
Author

As you mensioned, it's working typescript installed locally.
I understand ts-node >= 8.x is not working typescript installed globally, then I think it should be removed or updated about globally installation guide on readme file.

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants