SAP-samples/cloud-cap-samples

issue with @sap/cds/common in Visual Studio

shkwaseem86 opened this issue · 3 comments

I am using Visual Studio for SAP Cloud Application programming.
I get error with below statement , it says "Cannot find package module '@sap/cds/common'". Can anyone help me with this?

using { sap } from '@sap/cds/common';

chgeo commented

Please make sure to do an npm install in the root level of the project.

I get the same warning from the CDS linter in VS Code even though I have CDS installed and if I run the app no errors occur. I have CDS installed globally, however. I suspect maybe the linter only looks in the local node_modules folder and reports the package can't be found if it's not located there. To test, installed CDS in the local project, but I found that the linter still reported that it was unable to find the module (again, when loading the app there's no issue, the module load's fine).

Anyway, there does seem to be some error with the linter.

It also does not go away when we set "cds.compiler.detectLocalSapCdsInstallation": true
This is very annoying - not everyone likes to install global packages. It leads to inconsistencies.