Home > OS >  error in typing (datetime.d.ts) file which doesn't exist
error in typing (datetime.d.ts) file which doesn't exist

Time:09-27

I installed the typings for luxon with npm install --save-dev @types/luxon. Afterall I realized I don't need it and so I removed it manually:

  • removed folder node_modules/@types/luxon
  • removed entries in package.json
  • removed entries referencing luxon in package-lock.json

After building in Visual Studio 2022 I always get the error:

Build:Namespace 'Intl' has no exported member 'DateTimeFormatPart' and under the column Project this path (which doesn't exist) - the real path of the message was replaced by ...: C:\dev\...\node_modules@types\luxon\src\datetime.d.ts 1238

I also tried to use npm prune, but no success.

CodePudding user response:

This should be fixable by removing the node_modules directory (i.e. rm -r node_modules, or the window equivalent), followed by a clean install: npm install.

To prevent the problem in the future, a better way to uninstall packages is with npm uninstall, e.g. npm uninstall @types/luxon. Alternatively, you can remove the package from the dependencies or devDependencies in your package.json and run npm install.

CodePudding user response:

The problem was my folder structure. My FrontendCode is under c:\dev\solutionPath\ProjectPath and in this folder there is the node_modules folder. But one time accidentally I did npm install one folder above so under c:\dev\solutionPath there was also a node_models folder.

  • Related