typescript build cannot find module code example
Example 1: Cannot find module 'typescript'
npm install --global typescript
npm install --save-dev typescript
yarn global add typescript
yarn add --dev typescript
Example 2: cannot find module typescript
npm install -g typescript
Example 3: error TS2307: Cannot find module 'path' or its corresponding type declarations.
go to 'tsconfig.app.json' and add "node" to types:
/* To learn more about this file see: https://angular.io/config/tsconfig. */
{
"extends": "./tsconfig.json",
"compilerOptions": {
"outDir": "./out-tsc/app",
"types": ["node"] <------------ ADD "node" HERE
},
"files": [
"src/main.ts",
"src/polyfills.ts"
],
"include": [
"src/**/*.d.ts"
]
}
Example 4: cannot find module 'typescript' angular 9
npm install -g typescript