javascript – The problem of running symlink files by node js

I use symlink to run a project from a different directory inside a directory

But the execution time with the command ‍‍‍node App.js i get an error

Require stack:
- /Sample/NewCrawler/App.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:121:18)
    at Object.<anonymous> (/Sample/NewCrawler/App.js:1:23)
    at Module._compile (node:internal/modules/cjs/loader:1256:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/Sample/NewCrawler/App.js' ]
}

I realized nodejs it executes the file that was in the main path of the project, not in the linked path

I symlink file App.js from the path /sampel/NewCrawler/App.js to /Temp/NewCrawler/App.js And in the linked path of the command ‍‍‍‍‍ node App.js

Is there a solution to my problem?

Read more here: Source link