cancel
Showing results for 
Search instead for 
Did you mean: 

Facing error while building and watching CAP project.

AvaneeshPEOL
Explorer
914

I am getting the following error while executing an mta.yaml build or while executing "cds watch" command.

I am not entirely sure what is to be done for this.

user: xsuaa-user-test $ cds watch --profile hybrid
node:events:496
      throw er; // Unhandled 'error' event
      ^

Error: ENOENT: no such file or directory, stat '/home/user/projects/xsuaa-user-test/gen/srv/node_modules/@types/sap__cds'
    at statSync (node:fs:1659:25)
    at #watchFile (node:internal/fs/recursive_watch:152:28)
    at #watchFolder (node:internal/fs/recursive_watch:129:26)
    at #watchFolder (node:internal/fs/recursive_watch:131:30)
    at #watchFolder (node:internal/fs/recursive_watch:131:30)
    at #watchFolder (node:internal/fs/recursive_watch:131:30)
    at #watchFolder (node:internal/fs/recursive_watch:131:30)
    at [kFSWatchStart] (node:internal/fs/recursive_watch:200:26)
    at Object.watch (node:fs:2461:36)
    at tryWatch (/managed-content/globals/pnpm/5/.pnpm/node-watch@0.7.4/node_modules/node-watch/lib/watch.js:131:15)
Emitted 'error' event on Watcher instance at:
    at /managed-content/globals/pnpm/5/.pnpm/node-watch@0.7.4/node_modules/node-watch/lib/watch.js:134:15
    at process.processTicksAndRejections (node:internal/process/task_queues:77:11) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'stat',
  path: '/home/user/projects/xsuaa-user-test/gen/srv/node_modules/@types/sap__cds',
  filename: '/home/user/projects/xsuaa-user-test'
}

Node.js v20.12.0

 

Saritha_K
Contributor
0 Kudos

Hi Experts,

We are also facing the same error since few hours now. It was working fine 5 hours before.

Regards,

Saritha

hh
Explorer
0 Kudos
Hi together,
hh
Explorer
0 Kudos
Hi together, we have also the same problem... 😞
AvaneeshPEOL
Explorer
0 Kudos

It's been updated now, it works.

Please note the following.

I deleted the gen and node_modules folders, and then executed 'npm update' command, after which i could build and deploy the project.

View Entire Topic
WouterLemaire
Active Contributor
0 Kudos

Hmm the fact it worked earlier makes me think they released an update of one of the components.

Neverthess, when looking at the error it seems you are using typescript? I assume this because the error complaints about missing types. In that case, can you try to use cds-ts to run the watch command like this “cds-ts watch —profile hybrid” 

kr, Wouter

AvaneeshPEOL
Explorer
0 Kudos
user: xsuaa-user-test $ cds-ts watch --profile hybrid
/usr/bin/env: 'ts-node-cwd': No such file or directory

I don't think I'm using any Typescript as i'm getting the above