LoginSignup
0
0

More than 1 year has passed since last update.

Error: Cannot find module '@types/node/package.json'の解決法

Posted at

結論

$ tsc --init

ts-node を使った際に以下のエラーが出た際の解決方法です

~/Workspace/(master ✗) ts-node index.ts
Error: Cannot find module '@types/node/package.json'
Require stack:
- /usr/local/lib/node_modules/ts-node/dist/index.js
- /usr/local/lib/node_modules/ts-node/dist/repl.js
- /usr/local/lib/node_modules/ts-node/dist/bin.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
    at Function.resolve (internal/modules/cjs/helpers.js:80:19)
    at /usr/local/lib/node_modules/ts-node/src/index.ts:746:52
    at Array.map (<anonymous>)
    at Object.resolveTypeReferenceDirectives (/usr/local/lib/node_modules/ts-node/src/index.ts:734:33)
    at actualResolveTypeReferenceDirectiveNamesWorker (/usr/local/lib/node_modules/typescript/lib/typescript.js:109514:143)
    at resolveTypeReferenceDirectiveNamesWorker (/usr/local/lib/node_modules/typescript/lib/typescript.js:109773:26)
    at Object.createProgram (/usr/local/lib/node_modules/typescript/lib/typescript.js:109612:35)
    at synchronizeHostData (/usr/local/lib/node_modules/typescript/lib/typescript.js:153746:26)
    at Object.getProgram (/usr/local/lib/node_modules/typescript/lib/typescript.js:153878:13)
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0