Can you access node_modules or not?
Whatâs the path for it?
Uff, /node_modules
?
Hey @SWP360 the absolute path would be /app/node_modules
, which generally is a link to a directory on a shared device. You can access the files there, but changes to those files wonât be permanent; theyâll be overridden the next time your project restarts.
What is it that youâre trying to accomplish? We might be able to give better guidance if we understood your goals a little better.
I wanna start my app through a dependency if that makes sense
Iâm probably just missing the idea here; can you provide any more specific information to help me understand it better?
I wanna start my app in nodemon through package.json if thatâs possible
Your app has already built-in auto-update feature from Glitch. Every time you edit your app files, node project restarts automatically. If you want to configure restart delay, you can add watch.json file with this structure:
{
"install": {
"include": [
"^package\\.json$",
"^\\.env$"
]
},
"restart": {
"exclude": [
],
"include": [
"\\.js$",
"\\.json",
"\\.sqlite"
]
},
"throttle": 10000
}
âinstallâ means running pnpm install
, ârestartâ means restarting your project
MOD EDIT: minor correction
It appears that any edits I make to files within node_modules
gets overwritten each time the project re-starts. Is there any way to have edits persist?
Hey @donna0, generally speaking editing node_modules
files in Glitch isnât âbest practiceâ, whatever that really means. Since Glitch restarts your projects from a fresh (p)npm
installation every 12 hours or so, edited files in node-modules
wonât persist.
Depending on what you want to edit, you could âforkâ the module youâre hoping to update in GitHub and install your fork instead of the main module. You can also script replacing the default file with your edited file after the install
step but before the start
step by adding a prestart
script in your package.json
file as described in Default Node-red flow and pnpm, but thatâs a little convoluted too.
Either of those approaches (or really any approach that has you editing installed packages in your node_modules
directory) means that you wonât get the most recent updates to your package, which can be risky if they patch a security hole.
Hope this helps!