node error when calling "yarn start" in an app created by create-react-app - node.js

I recently created a new project with create-react-app, installed all newest packages for an old create-react-app project (which was using react-scripts 3.4.1, and the new project is using 5.0.0) and copied the old code and asset files over. To my puzzlement, the new project throws an error whenever I call "yarn start"
Starting the development server...
node:events:498
throw er; // Unhandled 'error' event
^
Error: read ECONNRESET
at TLSWrap.onStreamRead (node:internal/stream_base_commons:217:20)
Emitted 'error' event on ClientRequest instance at:
at TLSSocket.socketErrorListener (node:_http_client:442:9)
at TLSSocket.emit (node:events:520:28)
at TLSSocket.emit (node:domain:475:12)
at emitErrorNT (node:internal/streams/destroy:164:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -54,
code: 'ECONNRESET',
syscall: 'read'
}
Node.js v17.4.0
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
For what it's worth, the old project doesn't throw an error despite that the src code is the same. The only difference is the packages.
I googled around and followed various advice, including this one: https://medium.com/#premal.katigar/how-to-fix-throw-er-unhandled-error-event-30172323a973. All to no avail.
There are a couple of clues that could be useful:
I use an antd landing page, which is basically a bunch of .jsx and .less files that constructs a page. If I replace that landing page code with some simple jsx component, e.g. something that simply returns an h1 tag, then there is no longer this node error. Yarn start would start the project fine.
The only differences between the old project that starts fine even with the aforementioned antd landing page, and the new one that throws the above error are that 1) the new project contains all the newest versions of the required packages, since I used "yarn install" for all the required packages 2) since I'm using the newest version of antd, instead of using "customize-cra", "react-app-wired", "babel-plugin-import" and "less-loader", I was simply using "craco-less". So the old project's "yarn start" actually called "react-app-rewired start" and the new one actually called "craco start".
I also tried downgrading node version from 17 to 16, and the error remained.
Any clue what might be the issue?

Related

"vitest --ui" causing "Error: spawn xdg-open ENOENT"

I'm trying to check out Vitest's fancy UI server in my node docker container. But can't get it up and running. When running the npm script vitest --ui I get a node error spawn xdg-open ENOENT.
Here the full error message:
$ npm run test-ui
> wpvite#0.0.0 test-ui
> vitest --ui
DEV v0.23.4 /home/node/apps/main/frontend
UI started at http://localhost:51204/__vitest__/
node:events:491
throw er; // Unhandled 'error' event
^
Error: spawn xdg-open ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn xdg-open',
path: 'xdg-open',
spawnargs: [ 'https://localhost:51204/__vitest__/' ]
}
Node.js v18.10.0
Google is no help at all - nothing related to Vitest even close. Also I'm obviously not a Node.js expert.
Even though the Node.js error message appears pretty cryptic to me, I still was lucky to use Ubuntu as my primary OS (beside macOS) which made me draw my attention to xdg-open in the error message - I occasionally use the command to open all kind of programs/apps on Ubuntu. Don't know why, but you need to have xdg-open installed on your system, to be able to run vitest --ui, even though it's neither mentioned in Vitest nor in Vite Github repos with a single word. Anyway for debian based containers it's:
apt install xdg-utils --fix-missing
Allthough this made the ENOENT error go away and the UI server starts up without errors, I still don't get to see the UI app due to some runtime-dom errors... I give it up. But maybe someone else finds the xdg-open info helpful.
UPDATE: It's working!
I just had to append /__vitest__/ to my proxied local url as clearly described in the docs:
"Then you can visit the Vitest UI at http://localhost:51204/__vitest__/"

Executing node-jq throws an event.js error

i created a node application which is used to take a log file in json format and after processing the data, we create a csv file. i am using the following packages in the app
"dependencies": {
"bluebird":"^3.7.2",
"js-yaml":"^4.1.0",
"json2csv":"^5.0.6",
"node-jq": "^1.12.0",
"yargs": "^17.0.1"
}
The app has been working properly for last 6 months and there has been no change in code. We did a scheduled deployment 5 days back and since then it does not generate the report and we get this error when we try to generate the file.
events.js:377
throw er; // Unhandled 'error' event
^
Error: spawn C:\reporting-app\node_modules\node-jq\bin\jq ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:274:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:280:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn C:\\reporting-app\\node_modules\\node-jq\\bin\\jq',
path: 'C:\\reporting-app\\node_modules\\node-jq\\bin\\jq',
spawnargs: [
'--slurp',
'[ .[] .logs[] ] | map(select(.context.recordID != "12345")) | unique_by(.context.ID) | map(select(.context.ID != null)) | map({ ID: .context.ID, timestamp: .timestamp, kiosk: .context.recordID, appTransactionId: .context.appTransactionId })'
]}
I think the error comes when we try to use node-jq.run method (see below)
execute(source) {
return jq.run(this.query, source, {
input: 'string',
slurp: true,
});
}
Any help in this regard would be appreciated.
I dont know exactly what the problem was but I tried downgrading the version of node.js to an older version (which was used when the app was built and deployed). I deleted node_modules and package-lock.json files. Did an npm install and the the app started working locally. I promoted the package-lock.json files to the server and the server started working too.
I have a subsequent question. For last 5 months there was no change in the code. Not even package or package-lock.json files. However we did an npm install everytime we generated the report using this app. The dev ops say they did not update the node version on the server. Any one knows how this downgrade of node may have solved the problem?

React Native run-android not working

React Native run-android shows starting js server... but no server is started like it was starting before (nodejs winodow opens) and in the end it show following error:
Running C:\users\deepa\appdata\local\android\sdk/platform-tools/adb -s
192.168.105.101:5555 reverse tcp:8081 tcp:8081
Starting the app on 192.168.105.101:5555
(C:\users\deepa\appdata\local\android\sdk/platform-tools/adb -s
192.168.105.101:5555 shell am start -n
com.aptencemobileapp/com.aptencemobileapp.MainActivity)...
Starting: Intent { cmp=com.aptencemobileapp/.MainActivity }
events.js:183
throw er; // Unhandled 'error' event
^
Error: spawn cmd.exe ENOENT
at _errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
at onErrorNT (internal/child_process.js:372:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Please someone help me!
I don't know but sometimes I also got the same error. You just need to clean android build using following command.
goto your projrct android folder using cd android
hit the gradlew clean
again run the same command you are running.
Hope this will solve your problem.
Finally resolved it!
I reinstalled react-native-cli , nodejs added all paths to system and run following command.
adb reverse tcp:8081 tcp:8081

Fresh meteor 1.3 on win7 not runnning

I am also posting this on stackoverflow as this is suggested by meteor itself :)
I upgraded my meteor project to Meteor 1.3, and after updating all the proper packages I could not get meteor 1.3 to run. Then I created a fresh project and still get this error I posted below. I also tried to create the simple-todos example shown here https://www.meteor.com/tutorials/blaze/creating-an-app in CMD. Same result.
Windows 7 btw :) Also I have not installed meteorhacks:npm or any other extra packages whatsoever.
http.js:733
throw new TypeError('The header content contains invalid characters');
^
TypeError: The header content contains invalid characters
at ClientRequest.OutgoingMessage.setHeader (http.js:733:13)
at new ClientRequest (http.js:1429:14)
at Object.exports.request (http.js:1899:10)
at Array.stream [as 3] (C:\Users\Lightspeed\AppData\Local\.meteor\packages\meteor-tool\1.3.0_3\mt-os.windows.x86_32\dev_bundle\lib\node_modules\http-proxy\lib\http-proxy\passes\web-incoming.js:108:74)
at ProxyServer.<anonymous> (C:\Users\Lightspeed\AppData\Local\.meteor\packages\meteor-tool\1.3.0_3\mt-os.windows.x86_32\dev_bundle\lib\node_modules\http-proxy\lib\http-proxy\index.js:80:21)
at Proxy._tryHandleConnections (C:\tools\runners\run-proxy.js:182:20)
at Server.<anonymous> (C:\tools\runners\run-proxy.js:50:12)
at Server.emit (events.js:98:17)
at HTTPParser.parser.onIncoming (http.js:2164:12)
at HTTPParser.parserOnHeadersComplete [as onHeadersComplete] (http.js:152:23)
at Socket.socket.ondata (http.js:2022:22)
at TCP.onread (net.js:528:27)
Meteor does startup properly and does not crash until I actually navigate to localhost:3000. The page immediately errors (host not reachable) and meteor crashes with the error shown in my OP.
This problem was related to a specific windows 7 version. Though I don't have specifics anymore, it has been resolved.

Google IO web app setup error

I have been trying to setup the Google IO web app to learn more about the polymer framework that it uses. Google recently made it open source, so I have been trying to download it, using the instructions at: https://github.com/GoogleChrome/ioweb2015
As per the instructions, I have installed Go 1.4.2, as well as gcloud (and run the update app command). I also completed the first 3 of the setup commands, but when running 'gulp setup', I get the following error:
[19:54:17] Using gulpfile c:\polymer\ioweb2015\gulpfile.js
[19:54:17] Starting 'setup'...
[19:54:17] Starting 'bower'...
[19:54:17] Starting 'godeps'...
[19:54:17] Starting 'addgithooks'...
events.js:85
throw er; // Unhandled 'error' event
^
Error: spawn ../node_modules/bower/bin/bower ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
at node.js:814:3
I have looked around, but I cannot find any plausible cause of the error. I am probably missing something obvious, but I would really appreciate any help that you can give.
Many thanks,
--Matt

Resources