Search code examples
node.jssap-cap

vscode cds watch throws regular expression error


I currently try to solve an error which I experience in Visual Studio Code.

I am currently working locally with SAP Cloud Application Programming and using the module @sap/cds-dk so I can enter cds command in the command line.

Whenever I enter "cds watch" i get the following error:

SyntaxError: Invalid regular expression: /app.+?\webapp/: \ at end of pattern

Command line error text from vscode

Whenever I use cds serve or go into debug mode it works without a problem. Only cds watch is having the issue.

I also tried:

  • moving the workspace to a directory without spaces
  • different node versions
  • reinstalling node and vscode
  • setting up a completely new workspace and project

The error remains in all cases the same. I have the feeling I am missing something and hope that you can help me find it.

Thank you for your help!

Tried to enter cds watch to start my application in local mode.


Solution

  • cds-dk 8.7.0 was released 4 days ago. Maybe you noticed a window asking if you want to update ur global installation. There is something off in the new version when using vscode and windows 11. node.path returns a separator character (sep) which break the syntax in some new Regex expresions in the watch.js lib.

    I rolled back my global installation to 8.6.1 for the moment. Consider raising a bug on the repository.

    npm uninstall @sap/cds-dk -g
    npm install @sap/[email protected] -g