0

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?

sniffingdoggo
  • 398
  • 4
  • 16

1 Answers1

0

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
Mirusky
  • 372
  • 3
  • 16
  • I tried both attempts. The first one still won't work. The CMD throws the same errors. The second one throws another error when I type `create-express-api name-of-app` after installed the package globally. – sniffingdoggo Aug 04 '20 at 03:19
  • This is the error from second attempt: `File C:\Users\myPCname\AppData\Roaming\npm\create-express-api.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170. At line:1 char:1 + create-express-api server` – sniffingdoggo Aug 04 '20 at 03:20
  • It's so weird. I've cleared my PC completely for running this command w/o any crashes from the other apps. But it never works. – sniffingdoggo Aug 04 '20 at 03:25
  • Could you try to execute the command in admin console? – Mirusky Aug 04 '20 at 03:29
  • Still won't work. Both CMD throws the same errors what I got before, git CMD and Powershell. – sniffingdoggo Aug 04 '20 at 03:33
  • could you try to run in powershell console the following: ``Set-ExecutionPolicy Unrestricted`` and then ``create-express-api name-of-app`` – Mirusky Aug 04 '20 at 03:33
  • It says the file already exists: `fatal: destination path 'server' already exists and is not an empty directory. events.js:292 throw er; // Unhandled 'error' event ^ Error: spawn rm ENOENT` – sniffingdoggo Aug 04 '20 at 03:36
  • Let's try the following, delete the folder called ``server`` then in a powershell console ``Set-ExecutionPolicy Unrestricted`` and so ``create-express-api server`` – Mirusky Aug 04 '20 at 03:38
  • When I remove the `server` file and retry it, It creates the folder and files. However, it still throws this error: `events.js:292 throw er; // Unhandled 'error' event ^ Error: spawn rm ENOENT . . .` which is the same error from the first try. – sniffingdoggo Aug 04 '20 at 03:39
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/219155/discussion-between-gunblades-and-sniffingdoggo). – Mirusky Aug 04 '20 at 03:40