Error: Cannot find module 'typescript'
Closed this issue · 2 comments
liby commented
Version(if relevant): 1.0.0
Environment(if relevant):
- Irrelevant
Code(if relevant):
- Irrelevant
Expected:
- Normal execution
Actual:
Full Error Log
❯ type-coverage
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'typescript'
Require stack:
- /Users/user/.config/yarn/global/node_modules/type-coverage-core/dist/core.js
- /Users/user/.config/yarn/global/node_modules/type-coverage-core/dist/index.js
- /Users/user/.config/yarn/global/node_modules/type-coverage/dist/index.js
- /Users/user/.config/yarn/global/node_modules/type-coverage/bin/type-coverage
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/user/.config/yarn/global/node_modules/type-coverage-core/dist/core.js:4:12)
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) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/user/.config/yarn/global/node_modules/type-coverage-core/dist/core.js',
'/Users/user/.config/yarn/global/node_modules/type-coverage-core/dist/index.js',
'/Users/user/.config/yarn/global/node_modules/type-coverage/dist/index.js',
'/Users/user/.config/yarn/global/node_modules/type-coverage/bin/type-coverage'
]
}
❯ type-coverage -v
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'typescript'
Require stack:
- /Users/user/.config/yarn/global/node_modules/type-coverage-core/dist/core.js
- /Users/user/.config/yarn/global/node_modules/type-coverage-core/dist/index.js
- /Users/user/.config/yarn/global/node_modules/type-coverage/dist/index.js
- /Users/user/.config/yarn/global/node_modules/type-coverage/bin/type-coverage
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/user/.config/yarn/global/node_modules/type-coverage-core/dist/core.js:4:12)
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) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/user/.config/yarn/global/node_modules/type-coverage-core/dist/core.js',
'/Users/user/.config/yarn/global/node_modules/type-coverage-core/dist/index.js',
'/Users/user/.config/yarn/global/node_modules/type-coverage/dist/index.js',
'/Users/user/.config/yarn/global/node_modules/type-coverage/bin/type-coverage'
]
}
TypeScript has been installed globally.
❯ npm list -g --depth 0
/Users/user/.nvs/node/14.15.5/x64/lib
├── UNMET PEER DEPENDENCY @babel/preset-env@^7.1.6
├── jscodeshift@0.13.0
├── npm@6.14.11
├── typescript@4.3.5
└── yarn@1.22.10
plantain-00 commented
typescript is type-coverage
's peerDependencies
, see: https://npm.community/t/npm-doesnt-find-peer-dependency-from-global-package/6771/4
liby commented
Issue solved by using yarn global add typescript
(instead of npm install -g typescript
).
Thank you.