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
Related
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
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
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.
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
I am trying to create a React project in pycharm. I am using NVM version 0.34.0, and installed node using it.
Here is my pycharm window before starting a project
npm -v return 6.9.0
whereis npm returns npm: /home/usa/.nvm/versions/node/v12.3.1/bin/npm
Here is the error message
/home/usa/.nvm/versions/node/v12.3.1/bin/node /home/maged/.nvm/versions/node/v12.3.1/lib/node_modules/create-react-app/index.js .
Creating a new React app in /home/usa/Desktop/ny/untitled1.
/bin/sh: 1: npm: not found
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
events.js:177
throw er; // Unhandled 'error' event
^
Error: spawn npm ENOENT
at Process.ChildProcess._handle.onexit (internal/child_process.js:264:19)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:84:9)
Emitted 'error' event at:
at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12)
at onErrorNT (internal/child_process.js:456:16)
at processTicksAndRejections (internal/process/task_queues.js:84:9) {
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn npm',
path: 'npm',
spawnargs: [
'install',
'--save',
'--save-exact',
'--loglevel',
'error',
'react',
'react-dom',
'react-scripts#0.9.x'
]
}
Done
You installed npm and you can see its version, but you should add it to PATH variable in your system so other services can find it.
first run this in your terminal
cat $PATH
check the output to see npm path there if it wasn't there run below command and try again
export PATH=$PATH:/<path-to-npm-bin>/npm/bin