I am encountering an issue with a module that I am struggling to import.
Using Typescript 2.7 and Node 10
The pxl-ng-security module is showing an error in both VSCode and VS2019. When hovering over it, error 2307 is displayed.
Below is the import section from the file.
myfile.ts
import { Injectable } from '@angular/core';
import { Headers, Http, Response } from '@angular/http';
import { TokenService } from 'pxl-ng-security';
The gulp file is referencing tsconfig-library.json, indicating that it is using that file instead of the standard tsconfig.json.
tsconfig-library.json
{
"compilerOptions": {
"target": "es5",
"lib": ["es2015", "dom"],
"module": "es2015",
"moduleResolution": "node",
"declaration": true,
"experimentalDecorators": true,
"baseUrl": ".",
"stripInternal": true,
"outDir": "./dist",
"rootDir": "./src-embedded",
"sourceMap": true,
"inlineSources": true,
"skipLibCheck": true
},
"files": [
"./src-embedded/index.ts"
],
"angularCompilerOptions": {
"skipTemplateCodeGen": true
}
}
tsconfig.json
{
"compileOnSave": false,
"compilerOptions": {
"outDir": "./out-tsc",
"baseUrl": "src",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2016",
"dom"
]
}
}
I have attempted using ../../node_modules/pxl-ng-security, but the issue persists. Intellisense recognizes it and fills it in. The folder's presence in that location has been confirmed. Even after deleting it from node_modules and performing a npm-install -project-local, the module reappears, suggesting that the module itself is fine.
Running tsc -p . results in the following error:
error TS2307: Cannot find module 'pxl-ng-security' or its corresponding type declarations.
Trying to run gulp produces the error:
Error: Error encountered resolving symbol values statically. Could not resolve pxl-ng-security
New Developments: Upon checking on a CI/CD server, I noticed that the build process is successful, with the same code working without issues. To further investigate, I installed vscode on the server to see if the ts2307 error would appear there, but surprisingly, it did not. Both Node and Typescript versions match as well. The mystery deepens.