Is it possible to directly edit node modules?

I have some packages that I would like to edit to make it more convenient and fix some issues, but it seems practically impossible since you can’t access the node_modules folder. I’ve already implemented it on visual studio, but how would I do it in glitch?

To edit a file in the node_modules folder, you can follow these steps:

  1. Open a terminal and navigate to the node_modules folder using the ls command.
  2. Use the ls command to list the contents of the node_modules folder and find the folder that contains the file you want to edit.
  3. Navigate to the folder that contains the file you want to edit.
  4. Use the nano command to open the file in a text editor.
  5. Edit the file as needed and save your changes.

Alternatively, you can edit the .gitignore file to make the node_modules folder accessible. This will allow you to use a GUI-based text editor to modify the files inside the node_modules folder, which might be easier for some users.

I’d like to take the .gitignore route, but even after editing the node_modules out of it and refreshing, it still doesn’t show the folder. Any other ideas, or is there something I’m doing wrong?

Hi again! You don’t need to add the folder, you actually need to remove it. I think there’s a .gitignore command to show ignored folders
Update: Found what I wanted. view link

I tried that, but it didn’t work. Apparently, glitch purposely prevents you from loading the node_modules folder (I read that in another topic after digging a bit more), and the only way is to do it through the console. Your nano method worked though, just wish I could have it show up in the actual directory.

you can install a directory as a package

haven’t tried it in the main /app directory though. it might not work due to glitch symlinking node_modules to a separate drive though

Yeah, not sure you’d be able to move the file back into node_modules

you don’t have to move the file into node_modules if you do that. instead, npm symlinks it so that, for example, if you make a copy of the package into /app/vendor/somelib, /app/node_modules/somelib is a symlink to /app/vendor/somelib.

Didn’t know that, may have to try that out next time I need to edit a package

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.