I am working on a plain Typescript app and have successfully tested it with importing modules created by myself which are part of the project. Now I am trying to include a 3rd party module from 'node_modules'folder but the compiler is not able to find that module.
import * as pnp from '@pnp/pnpjs';
Below is my setting for tsconfig:
{
"compileOnSave": true,
"compilerOptions": {
"types": [],
"sourceMap": true,
"module": "amd",
"target": "es5",
"noEmitOnError": true,
"outDir": "./dist"
},
"exclude": [
"node_modules",
"obj",
"bin"
]
}
Below is my package.json:
{
"version": "1.0.0",
"name": "OSD.SharePointHostedApp",
"private": true,
"devDependencies": {
"@types/chai": "^4.1.7",
"@types/sharepoint": "^2013.1.6"
},
"dependencies": {
"jquery": "^3.3.1",
"@pnp/pnpjs": "^1.2.5",
"chai": "^4.2.0"
}
}
Typescript Version: 1.0.3.0. (I tried updating to latest but it still shows 1.0.30.0, maybe coz of this??)
What am I missing here? I have checked and verified that the 3rd party module is present in the node_modules.
Update
There was a problem with the version. Even though I had installed latest version of typescript 3.1.6 it was not being picked up and old version 1.0.3.0 was shown. Somehow Typescript 1.0 was installed as part of Microsoft SDKs in the folder C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0 . I deleted that folder and now when I do tsc -v latest version number is shown-> 3.1.6 . But the original issue still remains