How ignore node_modules preventing restore default settings? When i edit some file in node_modules (e.g. weather-js) then in some time changes are reset in that file.
Changes made manually to
node_modules are not guaranteed to be saved long-term, because we don’t store node_modules on the project filesystem (so that you have more space for your files).
If you really need to edit files in node_modules, then you’ll need to switch to npm as the package manager. It has several drawbacks, one of which is that the node_modules folder will take space in your project disk, it will be slower, etc. If you want to continue, then go to the console and run
In npm can i ignore node_modules in .gitignore file?
node_modules is not tracked by git. If you use npm, the changes you make inside node_modules won’t be reset.
Now how prevent to storage full in npm? I mean this error
ERROR ENOSPC: no space left on device, write
throw err; ^ Error: ENOSPC: no space left on device, write at Object.writeSync (fs.js:573:3) at Object.writeFileSync (fs.js:1180:26) at process.on (/home/nvm/pnpm/lib/node_modules/pnpm/lib/node_modules/pnpm-file-reporter/lib/index.js:25:12) at process.emit (events.js:187:15) at processEmit [as emit] (/home/nvm/pnpm/lib/node_modules/pnpm/lib/node_modules/signal-exit/index.js:149:35) at process.exit (internal/process.js:156:15) at Timeout.setTimeout [as _onTimeout] (/home/nvm/pnpm/lib/node_modules/pnpm/lib/err.js:10:30) at ontimeout (timers.js:427:11) at tryOnTimeout (timers.js:289:5) at listOnTimeout (timers.js:252:5)
you can’t, this is why npm is disabled by default and you should use pnpm (our default package manager). To switch back to pnpm, run
enable-pnpm in the Console.
May I ask you why you’re editing files in node_modules? It’s a very bad practice, you should never do that.
In one file i want translate text to my language.
I see… You might try this then:
switch back to pnpm (enable-pnpm).
copy the file you changed in another location, for example
changed-file.js. Make sure this file already contains the change you need.
package.json, in the
scriptssection, add a
"prestart": "cp changed-file.js node_modules/path/to/the/actual/file.js"
where “node_modules/path/to/the/actual/file.js” has to be replaced with… the path to the actual file you want to change
This way you make sure that the file with the corrections is always copied inside node_modules
Ok thanks for help. I’ll let you know if it worked