Skip to content

print a stack if setupProxy.js doesn't parse #10652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

scottlamb
Copy link

Before, npm start would say this:

Unexpected token '?'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/slamb/.npm/_logs/2021-03-04T20_50_38_776Z-debug.log

(The logfile isn't helpful; it doesn't even say the Unexpected token '?' part.)

After, the Unexpected token '?' line is replaced with the following:

/home/slamb/git/moonfire-nvr/ui/src/setupProxy.js:13
      target: process.env.PROXY_TARGET ?? "http://localhost:8080/",
                                        ^

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:1054:16)
    at Module._compile (internal/modules/cjs/loader.js:1102:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.before (/home/slamb/git/moonfire-nvr/ui/node_modules/react-scripts/config/webpackDevServer.config.js:123:9)
    at Server.setupBeforeFeature (/home/slamb/git/moonfire-nvr/ui/node_modules/webpack-dev-server/lib/Server.js:455:18)
    at Object.before (/home/slamb/git/moonfire-nvr/ui/node_modules/webpack-dev-server/lib/Server.js:515:16)

Before, `npm start` would say this:

```
Unexpected token '?'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/slamb/.npm/_logs/2021-03-04T20_50_38_776Z-debug.log
```

(The logfile isn't helpful; it doesn't even say the `Unexpected token
'?'` part.)

After, the `Unexpected token '?'` line is replaced with the following:

```
/home/slamb/git/moonfire-nvr/ui/src/setupProxy.js:13
      target: process.env.PROXY_TARGET ?? "http://localhost:8080/",
                                        ^

SyntaxError: Unexpected token '?'
    at wrapSafe (internal/modules/cjs/loader.js:1054:16)
    at Module._compile (internal/modules/cjs/loader.js:1102:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.before (/home/slamb/git/moonfire-nvr/ui/node_modules/react-scripts/config/webpackDevServer.config.js:123:9)
    at Server.setupBeforeFeature (/home/slamb/git/moonfire-nvr/ui/node_modules/webpack-dev-server/lib/Server.js:455:18)
    at Object.before (/home/slamb/git/moonfire-nvr/ui/node_modules/webpack-dev-server/lib/Server.js:515:16)
```
@facebook-github-bot
Copy link

Hi @scottlamb!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

scottlamb added a commit to scottlamb/moonfire-nvr that referenced this pull request Mar 4, 2021
It worked fine on my laptop with node.js v14.15.4, but not on my
new workstation with node.js v12.18.2 (as comes with Ubuntu 20.10).
It would print "Unexpected token '?'" without any clue what file the
error is in. I'm trying to fix that here:
facebook/create-react-app#10652
@facebook-github-bot
Copy link

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks!

@stale
Copy link

stale bot commented Jan 9, 2022

This pull request has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants