2

When I try to run npm start just after creating application with npx create-react-app, it does anything and exits with code 0.

When I try to execute npm start command, I get the following message:

C:\projects\novo-curriculo\ui>npm start

> novo-curriculo-ui@0.1.0 start C:\projects\novo-curriculo\ui
> react-scripts start

When I enable --verbose options, I receive the following logs, which are useless too.

C:\projects\novo-curriculo\ui>npm start --verbose
npm info it worked if it ends with ok
npm verb cli [
npm verb cli   'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Users\\gabriel\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'start',
npm verb cli   '--verbose'
npm verb cli ]
npm info using npm@6.14.5
npm info using node@v12.16.3
npm verb run-script [ 'prestart', 'start', 'poststart' ]
npm info lifecycle novo-curriculo-ui@0.1.0~prestart: novo-curriculo-ui@0.1.0
npm info lifecycle novo-curriculo-ui@0.1.0~start: novo-curriculo-ui@0.1.0

> novo-curriculo-ui@0.1.0 start C:\projects\novo-curriculo\ui
> react-scripts start

npm verb lifecycle novo-curriculo-ui@0.1.0~start: unsafe-perm in lifecycle true
npm verb lifecycle novo-curriculo-ui@0.1.0~start: PATH: C:\Users\gabriel\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\projects\novo-curriculo\ui\node_modules\.bin;C:\Python38\Scripts\;C:\Python38\;C:\Python27\;C:\Python27\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Program Files\Git\cmd;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_211\bin;C:\Program Files\nodejs\;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\gabriel\AppData\Local\Microsoft\WindowsApps;C:\Users\gabriel\AppData\Local\Programs\Microsoft VS Code\bin;C:\xampp\php\;C:\Users\gabriel\AppData\Local\ComposerSetup\bin;C:\Users\gabriel\AppData\Roaming\Composer\vendor\bin;C:\Program Files\MySQL\MySQL Workbench 8.0 CE\;C:\sqlite\;C:\Users\gabriel\AppData\Local\Android\Sdk\platform-tools;C:\Users\gabriel\AppData\Local\Android\Sdk\emulator;C:\Users\gabriel\Anaconda3;C:\Users\gabriel\Anaconda3\Scripts;c:\flutter\bin;C:\Users\gabriel\AppData\Roaming\npm
npm verb lifecycle novo-curriculo-ui@0.1.0~start: CWD: C:\projects\novo-curriculo\ui
npm info lifecycle novo-curriculo-ui@0.1.0~poststart: novo-curriculo-ui@0.1.0
npm verb exit [ 0, true ]
npm timing npm Completed in 701ms
npm info ok

Here you can see my package.json:

{
  "name": "novo-curriculo-ui",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^4.2.4",
    "@testing-library/react": "^9.5.0",
    "@testing-library/user-event": "^7.2.1",
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}

The npm configuration:

C:\projects\novo-curriculo\ui>npm config list
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.14.5 node/v12.16.3 win32 x64"

; userconfig C:\Users\gabriel\.npmrc
ignore-scripts = false

; builtin config undefined
prefix = "C:\\Users\\gabriel\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\projects\novo-curriculo\ui
; HOME = C:\Users\gabriel
; "npm config ls -l" to show all defaults.

And the npm global configuration.

C:\projects\novo-curriculo\ui>npm config -g list
; cli configs
global = true
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.14.5 node/v12.16.3 win32 x64"

; userconfig C:\Users\gabriel\.npmrc
ignore-scripts = false

; builtin config undefined
prefix = "C:\\Users\\gabriel\\AppData\\Roaming\\npm"

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = C:\projects\novo-curriculo\ui
; HOME = C:\Users\gabriel
; "npm config ls -l" to show all defaults.

I've spend all the day trying to solve this issue, but without success. Does anybody else having this also?

My system information is the following and I've tried to run this on command prompt (cmd) and Power Shell - both with the same results.

  • Windows 10 Pro (10.0.18363 Build 18363)
  • NPM 6.14.5
  • v12.16.3

Thank you.

Gabriel
  • 83
  • 2
  • 9
  • What is your IDE? – Amir H. Bagheri May 24 '20 at 05:07
  • Sounds like a question for https://github.com/facebook/create-react-app/issues, did you do a quick search there, first? – Mike 'Pomax' Kamermans May 24 '20 at 05:08
  • Excuse my ignorance, but what are you expecting? When I run `npm start`, much the same thing happens. Then I go browsing to my web api and in a web browser and everything functions as expected – Nick.Mc May 24 '20 at 05:08
  • I am assuming you're .NET developer. If that's the case, NPM does not act live Visual Studio and IIS and you have to manually open the browser. Then, browse localhost:8000. – Amir H. Bagheri May 24 '20 at 05:17
  • Does this answer your question? [NPM run \* doesn't do anything](https://stackoverflow.com/questions/59016328/npm-run-doesnt-do-anything) – RobC May 24 '20 at 14:13
  • My IDE is VS Code – Gabriel May 24 '20 at 15:02
  • @RobC, my issue is different. As you can see in the settings, the ignore-scripts is already false. Tks – Gabriel May 24 '20 at 15:04
  • @AmirH.Bagheri, I was .Net developr, but right now I'm developing PHP and using React as my frontend. The react scripts must generate the code and then starts a local server on port 3000. It also open the broser, but I use to turn off this config. Unfortunatelly, there is no answer on both 3000 and 8000 ports. – Gabriel May 24 '20 at 15:07
  • @Mike'Pomax'Kamermans, yes, I've been looking on the internet for a whole day before posting this here. I've tried lots of suggestions without progress. Tks. – Gabriel May 24 '20 at 18:08
  • So back up first: show how you actually invoke `create-react-app`, changing into its dir, and ... then what did you do? – Mike 'Pomax' Kamermans May 24 '20 at 18:22
  • @Mike'Pomax'Kamermans, the npm start finishes with code 0 without doing absolutely nothing as I described in my question. I Expect an output like the below, but instead I have the command prompt. Sorry if you not catch it; C:\projects\id\id-web>npm start > id-web@0.1.0 start C:\projects\id\id-web > react-scripts start i 「wds」: Project is running at http://192.168.0.18/ i 「wds」: webpack output is served from i 「wds」: 404s will fallback to / Starting the development server... – Gabriel May 24 '20 at 18:26
  • @Mike'Pomax'Kamermans Dude, it is a brand new project. I've tried to create and recreate it many times. Also, I've uninstalled and installed again the nodejs with different configurations, without any success - I have other projects that works fine, but in this particular one doesnt (I also tried to change the path and name of project)... I wondering if there is something on OS/Windows Defender/Firewall blocking that - but have no events on EventLogs. – Gabriel May 24 '20 at 18:31
  • right, but you're not showing the important bits here: _what did you do_ to get to the point where you issue `npm start`? Because I just ran through the normal create-react-app steps (see answer), and I cannot reproduce your problem. Did you do anything different? And whether you did or not: please show the actual commands you used to get from "I have nothing" to "create-react-app is done and this is the start command I used" with the directories you're in when you do this. Right now, following your text-only description, this works fine and people won't be able to reproduce your problem. – Mike 'Pomax' Kamermans May 24 '20 at 18:31
  • @Mike'Pomax'Kamermans, first of all, I very appreciate your efforts to help me! I did the commands you did in your answer (npm install -g create-react-app --force, then create-react-app my-ui, then cd my-ui and finally npm start). Do you know if there is a way to enable tracing or something in order to see the point it closes? I've tried --verbose, but it is useless. – Gabriel May 24 '20 at 18:44
  • Can you zip your project folder and share it with us? If something is wrong the project itself, it would be very helpful to be able to reproduce the issue. – CherryDT May 24 '20 at 19:34
  • Hi @CherryDT, sure i can, but I'm guessing that it will work in your machine. I think there something on my machine that causes this behavior... But can't debug it once there is no messages. I'm lost without any logs... Anyway, how can I share the zip with you? – Gabriel May 24 '20 at 19:42
  • 1
    You can put it on [WeTransfer](https://wetransfer.com/). I just thought, you said in other projects it works for you, so I was wondering if there is something weird with that one... – CherryDT May 24 '20 at 19:47

3 Answers3

2

I've helped @Gabriel to debug the issue, and I have to say, it's a really weird one.

First, the immediate workaround: Renaming the folder novo-curriculo fixes it. (Note that this is not the project folder itself, that would be my-ui, but one above it.)

The real answer is: The application "Warsaw" is interfering with your app.

It's a piece of software by GAS Tecnologica/Diebold/Nixdorf, a "protection module" used by some Brazilian banks to somehow protect their online banking access from malware on the computer. Uninstalling it fixes the issue (and possibly some other issues on the computer as well). Just go to "Add/Remove Programs" and look for "Warsaw" and remove it.

(This is not the first time that this protection module caused issues, by the way. In 2015 it caused IPv6 connections to break.)


The technical explanation, as far as I was able to figure it out, is as follows:

First we have to know that npm start causes a chain of subprocesses to be spawned here.

  • node "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" start
  • node "C:\projects\novo-curriculo\my-ui\node_modules\.bin\react-scripts" start
  • node "C:\projects\novo-curriculo\my-ui\node_modules\.bin\..\react-scripts\bin\react-scripts.js" start

The last one failed to start. And it did so in a really weird way: The process was created but immediately exited, with "success" - exit code zero. So, no error was shown, nothing out of the ordinary other than just the process immediately exiting.

It can be seen here in Process Monitor:

ProcMon screenshot

What's shown here is that immediately after the process starts (it just loaded ntdll.dll and didn't even load any of the other DLL dependencies yet) it quits. This is highly unusual.

But it gets even more mysterious, because manual testing revealed that node node_modules\react-scripts\bin\react-scripts.js start would work fine, while node "C:\projects\novo-curriculo\my-ui\node_modules\react-scripts\bin\react-scripts.js start" would not.

Playing around with the command line showed that it has nothing to do with the actual physical folders or files involved. node --version normally prints the node.js version, even if followed by another argument, say node --version abcdefg. However, as soon as I put an argument that contained the pattern \*novo-curriculo*\*.js (and the executable was node), it exited without printing the version! For example, node --version \1111novo-curriculo1111\1111.js.

Trying to debug the node process in x64dbg made it obvious that some unknown external force closed the process as soon as it was started, because even if x64dbg broke into the process at the point ntdll was loaded, it was already gone by the time the disassembly was loaded, and trying to execute a single instruction immediately resulted in "debugging stopped", with the processing having died with exit code zero.

Therefore it must have been some sort of mechanism, probably a kernel driver or a service, that terminates processes as soon as they start if their command line matches certain patterns. That would sound like either a piece of malware (a rootkit scan came back clean though), or anti-virus (which wasn't the case since the only anti-virus in play was Windows Defender), or some sort of (badly programmed) anti-cheat system of some game. Turned out the last one was almost right - it was the online banking protection system!

So, bottom line: This Warsaw "protection module" for online banking (which should supposedly protect you from spyware while you are using online banking) is badly programmed and can terminate other processes without any obvious reason (when their command line matches some sort of pattern) and without giving any warning or message about it.

CherryDT
  • 25,571
  • 5
  • 49
  • 74
1
  1. Make sure you are using the latest npm version
  2. Delete the node_modules folder and run npm install
  3. Make sure you have enough memory when starting the react app
  4. Try to run cmd as Administrator
  • 2
    Never, ever, do (4). `npm` was specifically designed to never need admin rights, because code from npm is _untrusted_ and can literally wipe your entire fillesystem without you ever saying you're okay with that because of `postinstall` scripts. So again: never, ever, run `npm` as admin. – Mike 'Pomax' Kamermans May 24 '20 at 20:27
0

Let's get back to basics: create-react-app is generally installed globally because it's a project builder, not "a library", so I've got this working just fine using the following steps:

D:\temp>npm install -g create-react-app

[...create-react-app install log]

D:\temp>create-react-app test

Creating a new React app in D:\temp\test.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...

[...bootstrapping log...]

We suggest that you begin by typing:

  cd test
  npm start

Happy hacking!

So that's straight forward: it's telling us what to do:

D:\temp>cd test

D:\temp\test>npm start

> test@0.1.0 start D:\temp\test
> react-scripts start

[ screen wipe ]

Compiled successfully!

You can now view test in the browser.

  http://localhost:3000

Note that the development build is not optimized.
To create a production build, use npm run build.

So this works just fine: what steps did you perform that differ form these?

Mike 'Pomax' Kamermans
  • 49,297
  • 16
  • 112
  • 153
  • Didn't work. I did exactly the same as you, and got the same output unti the start. But when I executed the npm start, it shows ``` C:\projects\novo-curriculo\my-ui>npm start > my-ui@0.1.0 start C:\projects\novo-curriculo\my-ui > react-scripts start C:\projects\novo-curriculo\my-ui> ``` – Gabriel May 24 '20 at 18:39
  • If you really ran these exact same commands and it doesn't work, this is not a question for SO: you really should be filing this as an issue over on https://github.com/facebook/create-react-app/issues because you are running into bugs that the developers should be aware of, and help fix. – Mike 'Pomax' Kamermans May 24 '20 at 20:25
  • @Mike'Pomax'Kamermans turns out it was [a totally different issue](https://stackoverflow.com/a/61993604/1871033), a sneaky one caused by an online banking protection application, unrelated to `create-react-app` – CherryDT May 24 '20 at 23:27