live-server not opening up the website automatically - node.js

I installed node.js, and "npm install -g live-server"
After that the input of "live-server" in the command line prompt should open up the website that is situated in the current folder, but every time I try to do that, this shows up:
Serving "C:\Users\AAYUSHI\bg-gen" at http://127.0.0.1:8080
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://127.0.0.1:8080' ] }
No browser opens up my website automatically.
What do you think is the problem?

I checked system variables one more time and found the cause of the problem: missing C:\Windows\System32\ variable. I added it and that solved my problem
Hope, it help you too.

Most likely issue with opening the browser. Use this option instead:
live-server dist --port=3000 --no-browser

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

yarn/npm start gives permission error with local dev server create-react-app

Whenever I try to start the development server, I have to do so with sudo yarn start.
This is obviously not preferable.
If I do it without sudo, I get the following error:
Starting the development server...
node:events:368
throw er; // Unhandled 'error' event
^
Error: spawn firedragon 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 firedragon',
path: 'firedragon',
spawnargs: [ 'http://localhost:3001' ]
}
I tried changing permissions of npm binaries in /usr/bin/ and got myself into a whole sudo permissions debacle that I thankfully got myself out of.
I also tried to wipe every trace of yarn, npm, and node from my machine and reinstalled everything to no avail.
If anyone has any answers, please, I could use your help.
Downgrade with this command: npm install react-scripts#2.1.8

npm start react issue

i have alawys use npm start to run a React application
these days i try to use this command i got an error
and it goes like this
ps: i'm using ubuntu 20.04
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:480: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:480:16)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn brave',
path: 'brave',
spawnargs: [ 'http://localhost:3000' ]
}
I have deleted the cache,
I did delete node_modules and run npm install
and still i face the same problem
and if i use sudo npm start everything works fine
I think you installed node with root permission, that we lead to restricting non-sudo to use global packages.
I suggest that you remove the current node installation, and use nvm instead to install the desired node version https://github.com/nvm-sh/nvm.
after that, you need to install react-create-app again.

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