Error trying to execute react frontend (linked to backend) - node.js

I have recently tried to deploy a app consisting of react frontend and node backend on a linux machine.
While executing the frontend i got the following error:
(I used the command npm start)
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: [ 'http://localhost:3000' ]
}
Node.js v18.12.1

Related

Vue 3 returns an error after running my project and compiling it with npm run dev

Good day. I tried installing the dependencies of a Vue.JS app repository npm install.
Then, I run the Vue.JS app using npm run dev. However, after running it, it shows the following error in the terminal:
PS G:\malaysia-coronavirus> npm run dev
> malaysia-coronavirus#0.0.0 dev
> vite
node:events:504
throw er; // Unhandled 'error' event
^
Error: spawn G:\malaysia-coronavirus\node_modules\esbuild\esbuild.exe ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:478:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn G:\\malaysia-coronavirus\\node_modules\\esbuild\\esbuild.exe',
path: 'G:\\malaysia-coronavirus\\node_modules\\esbuild\\esbuild.exe',
spawnargs: [ '--service=0.12.15', '--ping' ]
}
How do I fix this? Did I do something wrong with the dependencies?
Are there any missing installation that I accidentally skipped?
I found a way to fix it. I just had to simply run:
node ./node_modules/esbuild/install.js
Answer from this thread: https://github.com/vitejs/vite/issues/1361#issuecomment-754442599

Error: write EPIPE on nextJs (11.1.0) build

I am trying to create my app build on nextJs (v11.1.0), Webpack (5.30.0) with yarn PnP but 99% of the times my build fails with the following error:
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at ChildProcess.target._send (internal/child_process.js:839:20)
at ChildProcess.target.send (internal/child_process.js:710:19)
at ChildProcessWorker.initialize (/tmp/.yarn/__virtual__/jest-worker-virtual-0fce01769d/0/cache/jest-worker-npm-27.0.0-next.5-6f53fab806-d56bfe67cd.zip/node_modules/jest-worker/build/workers/ChildProcessWorker.js:181:11)
at ChildProcessWorker._onExit (/tmp/.yarn/__virtual__/jest-worker-virtual-0fce01769d/0/cache/jest-worker-npm-27.0.0-next.5-6f53fab806-d56bfe67cd.zip/node_modules/jest-worker/build/workers/ChildProcessWorker.js:275:12)
at ChildProcess.emit (events.js:400:28)
at ChildProcess.emit (domain.js:470:12)
at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
Emitted 'error' event on ChildProcess instance at:
at internal/child_process.js:843:39
at processTicksAndRejections (internal/process/task_queues.js:77:11) {
errno: -32,
code: 'EPIPE',
syscall: 'write'
I am confused as to why the jest worker is active on build time.

Why won't zsh run npm scripts

My default SHELL is zsh, when I run npm start inside react folder it doesn't seem to work,
Starting the development server...
node:events:371
throw er; // Unhandled 'error' event
^
Error: spawn brave ENOENT
at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node:internal/child_process:288:12)
at onErrorNT (node:internal/child_process:477:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn brave',
path: 'brave',
spawnargs: [ 'http://localhost:3001' ]
}
On the other hand, if I use the bash terminal or vs terminal (bash kind) it does work properly

npx create-express-api keeps getting unknown errors

I keep getting errors on CMD when I try to use create-express-api for somewhat reasons.
Launched by git CMD:
Cloning into 'server'...
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn rm ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn rm',
path: 'rm',
spawnargs: [ '-rf', 'server/.git' ]
}
Launched by Powershell:
fatal: destination path 'server' already exists and is not an empty directory.
events.js:292
throw er; // Unhandled 'error' event
^
Error: spawn rm ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn rm',
path: 'rm',
spawnargs: [ '-rf', 'server/.git' ]
}
I have downloaded all the softwares & control systems that make running the package, npm, npx, git and also downloaded npm i create-express-api.
npm -v: 6.14.6
npx -v: 6.14.6
git --version: git version 2.28.0.windows.1
Why can't I use the package by using npx command?
Any solutions?
So I've tried in my machine... I do the following:
npx create-express-api name-of-app
And everything goes right. I could open the folder name-of-app and ran npm run dev and worked
Another try is install global and run:
npm install -g create-express-api
create-express-api name-of-app
The last way is to clone the repository manually and install its dependencies
git clone https://github.com/w3cj/express-api-starter.git server
cd server
npm install

Launching Vue UI throws error: spawn cmd ENOENT

When in cmd and I use the 'vue ui' command I get this error:
events.js:288
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12)
at onErrorNT (internal/child_process.js:469:16)
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [ '/c', 'start', '""', '/b', 'http://localhost:8000' ]
}
I've made sure node and vue are both up to date and have uninstalled/reinstalled both to be sure there wasn't something wrong there. Any help would be greatly appreciated. If you need more info please let me know.
You should add C:\Windows\System32 folder to you environment variables

Resources