System limit for number of file watchers reached, but I can't use sudo to fix it - react-native

I have looked around for a solution for this issue, but I do not have admin permissions so I cannot increase the limit of file watchers. I also have a very small project, so I don't understand how it can reach the limit. Does anyone know any fixes that don't involve admin permissions?
The entire error I got was:
Error: ENOSPC: System limit for number of file watchers reached, watch '/home/ludkl571/Documents/TDDC73/test/node_modules/#react-native-community/cli-tools/node_modules/chalk'
at FSWatcher.start (internal/fs/watchers.js:210:26)
at Object.watch (fs.js:1444:11)
at NodeWatcher.watchdir (/home/ludkl571/Documents/TDDC73/test/node_modules/sane/src/node_watcher.js:159:22)
at Walker.<anonymous> (/home/ludkl571/Documents/TDDC73/test/node_modules/sane/src/common.js:109:31)
at Walker.emit (events.js:314:20)
at /home/ludkl571/Documents/TDDC73/test/node_modules/walker/lib/walker.js:69:16
at FSReqCallback.oncomplete (fs.js:156:23) {
errno: -28,
syscall: 'watch',
code: 'ENOSPC',
path: '/home/ludkl571/Documents/TDDC73/test/node_modules/#react-native-community/cli-tools/node_modules/chalk',
filename: '/home/ludkl571/Documents/TDDC73/test/node_modules/#react-native-community/cli-tools/node_modules/chalk'
}

echo fs.inotify.max_user_watches=524288 try this command

Related

EPERM: operation not permitted, stat 'C:\$Recycle.Bin\desktop.ini'

trying to build a react app with vite(npm run build) but this appears.
cleaned cashe and reinstalled npm a couple times with vs code closedbut still doesnt work. tried using the command as administator in the terminal but still the error appears and some random files from the C: appeared in the outDir folder like bootmgr (not the real one, it onlt appeard in vs code and deleting it didnt do anything and the real bootmgr is still in C:)
EPERM: operation not permitted, stat 'C:$Recycle.Bin\desktop.ini'
error during build:
Error: EPERM: operation not permitted, stat 'C:$Recycle.Bin\desktop.ini'
at Object.statSync (node:fs:1551:3)
at copyDir (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:2553:34)
at copyDir (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:2555:13)
at prepareOutDir (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:41439:9)
at doBuild (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:41408:13)
at async build (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\chunks\dep-59dc6e00.js:41244:16)
at async CAC. (C:\Users\HP\Desktop\XalinPaintWeb\XalinPaint\node_modules\vite\dist\node\cli.js:738:9)
the value in the public dir in the vite config was "/src" and it tried to get the value not from the relative location like location/src but C:/src

"Cannot read property 'upgrade' of undefined" when starting vue application

I have a project that's been running perfectly for a few months now, able to run npm run serve with no problem. I have to terminate and run the command again whenever I switch networks, but that has never been a problem and the server could always start again.
Until now - no matter what I do I can't get the server to start. I get this error:
npm run serve
> xbs#0.6.2 serve D:\workspace\[PROJECT]
> vue-cli-service serve
INFO Starting development server...
10% building 1/1 modules 0 active ERROR TypeError: Cannot read property 'upgrade' of undefined
TypeError: Cannot read property 'upgrade' of undefined
at Server.<anonymous> (D:\workspace\[PROJECT]\node_modules\webpack-dev-server\lib\Server.js:667:47)
at Array.forEach (<anonymous>)
at new Server (D:\workspace\[PROJECT]\node_modules\webpack-dev-server\lib\Server.js:666:22)
at serve (D:\workspace\[PROJECT]\node_modules\#vue\cli-service\lib\commands\serve.js:137:20)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
at Function.Module.runMain (module.js:695:11)
at startup (bootstrap_node.js:191:16)
at bootstrap_node.js:612:3
The last time I got this message was when I forgot to set the .env files, but this is a previously working copy with all necessary files set, and no changes since the last working run.
I've even tried pulling a fresh copy of the repo, running npm i and setting all env files but it still fails.
npm run lint and npm run build can still work, only npm run serve.
Am I missing anything?
The problem was again with the .env files. My vue.config.js was trying to access a previously set environment variable that had since been removed.
Only strange thing was that there weren't any problems up til now?
I guess your devServer.proxy.target is empty!
You could set this configuration
For me it was that I forgot to create (or copy from another PC) the .env file after clone and try to run my project on another PC.
I also had this problem.
I used in the project process to get the backend address(for example):
devServer: {
proxy: {
'/api/back/*': {
target: process.env.VUE_APP_BACKEND_URL,
pathRewrite: {
'/api/back': '/api/back',
},
},
},
},
But there was no .evn file.
Just create .env file:
VUE_APP_BACKEND_URL= 0.0.0.0:2222 #example
Didn't notice the answer #Sergey.
I declared this environment variable in .env.dev, but the local build failed, and the same project ran without problems, so I created a new .env file and declared it in it
proxy: {
'/api': {
target: process.env.VUE_APP_PROXY,
changeOrigin: true,
pathRewrite: {
'^/api': ''
}
}
}

Node.js/ webpack/ getaddrinfo looking for internet when not needed, why?

I've got an issue with a machine that's supposed to be able to run offline.
I can pull the cable after my application is running, but during unplugged start I get the following error:
May 6 23:04:50 myco serve[4121]: (node:4121) UnhandledPromiseRejectionWarning: Error: getaddrinfo EAI_AGAIN registry.npmjs.org:443
May 6 23:04:50 myco serve[4121]: at Object._errnoException (util.js:1022:11)
May 6 23:04:50 myco serve[4121]: at errnoException (dns.js:55:15)
May 6 23:04:50 myco serve[4121]: at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
May 6 23:04:50 myco serve[4121]: (node:4121) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
May 6 23:04:50 myco serve[4121]: (node:4121) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
It appears that dns.js is part of webpack/node-libs-browser but thats as far as I can seem to figure out.... I can't find GetAddrInfoReqWrap anywhere in my source tree, or getaddrinfo for that matter. Searching around there's a lot of info with people getting similar errors when deliberately trying to use npm, but thats not what I'm doing. I should have everything I need already on the machine.
Apparently this is a problem with serve.
Serve >6.5.3 apparently has an issue where it tries to contact the registry. Downgrade of serve to 6.5.3 solves this particular issue.
this is documented in https://github.com/zeit/serve/issues/348
not sure why serve would need to contact the registry.
noafterglow is right, but just for reference, rolling back to version 6.5.3 of serve can be accomplished with
npm install -g serve#6.5.3
Source: this post
I ran into exactly this error when trying to serve a VueJs app from a different VM from where the code was developed originally.
The file vue.config.js read :
module.exports = {
devServer: {
host: 'tstvm01',
port: 3030,
},
};
When served on the original machine the start up output is :
App running at:
- Local: http://tstvm01:3030/
- Network: http://tstvm01:3030/
Using the same settings on a VM tstvm07 got me a very similar error to the one the OP describes:
INFO Starting development server...
10% building modules 1/1 modules 0 activeevents.js:183
throw er; // Unhandled 'error' event
^
Error: getaddrinfo EAI_AGAIN
at Object._errnoException (util.js:1022:11)
at errnoException (dns.js:55:15)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:92:26)
If it ain't already obvious, changing vue.config.js to read ...
module.exports = {
devServer: {
host: 'tstvm07',
port: 3030,
},
};
... solved the problem.

Constant error when writing in files in create-react-app based project in WebStorm

I am constantly getting an error from babylon.js (which I'm not sure I'm even using?) in my "Run" terminal in WebStorm.
I get the following error:
cmd.exe /D /C call C:/Users/Jens/IdeaProjects/Vaskemaskine/WashingmachineFrontend/vaskemaskine-app/node_modules/babel-core/node_modules/.bin/babylon.cmd --source-maps --out-file strings-compiled.js --presets es2015 C:\Users\Jens\IdeaProjects\Vaskemaskine\WashingmachineFrontend\vaskemaskine-app\src\strings.js
fs.js:549
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open 'C:\Users\Jens\IdeaProjects\Vaskemaskine\WashingmachineFrontend\vaskemaskine-app\src\--source-maps'
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Object.<anonymous> (C:\Users\Jens\IdeaProjects\Vaskemaskine\WashingmachineFrontend\vaskemaskine-app\node_modules\babel-core\node_modules\babylon\bin\babylon.js:13:15)
Occasionally I will also get an error in a popup in WebStorm:
Cannot save C:\Users\Jens\IdeaProjects\Vaskemaskine\WashingmachineFrontend\vaskemaskine-app\src\strings.js.
The file left unchanged.
Your changes were written to strings.js___jb_tmp___.
Not sure if that is related or not.
I tried googling around, but no one seems to be having the same problem as me. Anyone has a clue about what is going on? I haven't configured the scripts delivered with create-react-app, other than "ejecting" out.

npm windows package.json wildcard select concat-cli

I'm having some issues on Windows env. with npm & a package.json, mainly with one of the devDependencies, concat-cli.
Here's a little sample of the package.json file:
...
scripts{
...
"js-vendor-concat": "concat-cli -f src/js/vendor/**/*.js -o dist/js/vendors.js",
...
}
....
"devDependencies": {
...
"concat-cli": "^4.0.0"
...
}
So what happens is that every time I run that script in Windows env, I get Error: Error: EISDIR: illegal operation on a directory, read at errorHandler (index.js:11:15). Thing is that on linux, this error doesn't come up.
Things tried so far:
used git-bash and cygwin but same outcome
changed the input path to: src/js/vendor/*.js, again same outcome
However if I specify the name of the file, it works, so I'm guessing its something related to that wildcard *.js selector?
Any tips or pointers are much appreciated, thanks!