Here, I am specifying root as a relative path from the project directory. The expected behaviour is to have uploads directory inside my project directory. When I run the project using node . or node server/server.js command (from project directory), the connector works absolutely fine.
However when I navigate to any directory other than the project and try to start loopback server using node path/to/my/project/server/server.js, the connector starts looking for the root path in the current working directory, not actual project directory, thus giving Path does not exist exception.
Expected result
One should be able to run loopback project from any directory, not just project directory.
Additional information
The root cause is that fs.existsSync function checks if a file/directory exists by attaching the relative path to present working directory, not to the main script
Description/Steps to reproduce
To give you some context, my datasources.json file currently looks like this.
Here, I am specifying
root
as a relative path from the project directory. The expected behaviour is to haveuploads
directory inside my project directory. When I run the project usingnode .
ornode server/server.js
command (from project directory), the connector works absolutely fine.However when I navigate to any directory other than the project and try to start loopback server using
node path/to/my/project/server/server.js
, the connector starts looking for the root path in the current working directory, not actual project directory, thus givingPath does not exist
exception.Expected result
One should be able to run loopback project from any directory, not just project directory.
Additional information
The root cause is that
fs.existsSync
function checks if a file/directory exists by attaching the relative path to present working directory, not to the main script