Skip to content
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

Fresh install will not start... Syntax Error #3199

Closed
jeffreyhawkins opened this issue Aug 3, 2020 · 11 comments · Fixed by #3213
Closed

Fresh install will not start... Syntax Error #3199

jeffreyhawkins opened this issue Aug 3, 2020 · 11 comments · Fixed by #3213
Labels
bug An error in the Docusaurus core causing instability or issues with its execution v1 This issue is for Docusaurus 1

Comments

@jeffreyhawkins
Copy link

jeffreyhawkins commented Aug 3, 2020

🐛 Bug Report

Followed steps in the Getting Started section (https://docusaurus.io/docs/en/installation) to install version 1.14.5 of Docusaurus.

node: v12.18.3
npm: 6.14.6
yarn: 1.22.4

To Reproduce

mkdir mysite
cd mysite

npx docusaurus-init
cd website
yarn start

Expected behavior

Expected the server to start so I could begin writing docs for my site.

Actual Behavior

yarn start fails with Syntax Error

$yarn start
yarn run v1.22.4
warning package.json: No license field
$ docusaurus-start
LiveReload server started on port 35729
Failed to start Docusaurus server: SyntaxError: Unexpected token (37:15)
error Command failed with exit code 1.

Your Environment

  • Docusaurus version used: 1.14.5
    node: v12.18.3
    npm: 6.14.6
    yarn: 1.22.4
    macOS 10.14.5
@jeffreyhawkins jeffreyhawkins added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Aug 3, 2020
@slorber
Copy link
Collaborator

slorber commented Aug 3, 2020 via email

@thmarra
Copy link

thmarra commented Aug 3, 2020

Same here

@nikolasj
Copy link

nikolasj commented Aug 4, 2020

Same here((

@azagaya
Copy link

azagaya commented Aug 4, 2020

Same here.

@slorber
Copy link
Collaborator

slorber commented Aug 4, 2020

sorry for that will take a look asap

@slorber
Copy link
Collaborator

slorber commented Aug 4, 2020

Something weird I noticed is that on my computer, running npx docusaurus-init init website actually produces a v2 site instead of a v1 site.

But, the v2 site does not work due to a validation error:

image
Maybe this is a bug only I have for some weird reason...

Can you please tell me what's your package.json, and confirm you are on v1? Not only @jeffreyhawkins , but all of you please.

If you are on v1, is the error SyntaxError: Unexpected token ? are there additional info like a stracktrace, screenshot, or something to share?

@jeffreyhawkins
Copy link
Author

I can confirm version 1.14.5 is in the package.json.

They only error I see is SyntaxError: Unexpected token (37:15) no other information is shown.

@jeffreyhawkins
Copy link
Author

Screen Shot 2020-08-04 at 1 46 21 PM

@thmarra
Copy link

thmarra commented Aug 4, 2020

package.json

{
  "scripts": {
    "examples": "docusaurus-examples",
    "start": "docusaurus-start",
    "build": "docusaurus-build",
    "publish-gh-pages": "docusaurus-publish",
    "write-translations": "docusaurus-write-translations",
    "version": "docusaurus-version",
    "rename-version": "docusaurus-rename-version"
  },
  "devDependencies": {
    "docusaurus": "^1.14.5"
  }
}

the logs:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/home/username/.nvm/versions/node/v12.18.1/bin/node',
1 verbose cli   '/home/username/.nvm/versions/node/v12.18.1/bin/npm',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.14.5
3 info using node@v12.18.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle @~prestart: @
6 info lifecycle @~start: @
7 verbose lifecycle @~start: unsafe-perm in lifecycle true
8 verbose lifecycle @~start: PATH: /home/username/.nvm/versions/node/v12.18.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/username/projects/website/node_modules/.bin:/home/username/.nvm/versions/node/v12.18.1/bin:/home/username/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle @~start: CWD: /home/username/projects/website
10 silly lifecycle @~start: Args: [ '-c', 'docusaurus-start' ]
11 silly lifecycle @~start: Returned: code: 1  signal: null
12 info lifecycle @~start: Failed to exec start script
13 verbose stack Error: @ start: `docusaurus-start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/home/username/.nvm/versions/node/v12.18.1/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (/home/username/.nvm/versions/node/v12.18.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid @
15 verbose cwd /home/username/projects/website
16 verbose Linux 5.4.0-42-generic
17 verbose argv "/home/username/.nvm/versions/node/v12.18.1/bin/node" "/home/username/.nvm/versions/node/v12.18.1/bin/npm" "start"
18 verbose node v12.18.1
19 verbose npm  v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error @ start: `docusaurus-start`
22 error Exit status 1
23 error Failed at the @ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

@slorber
Copy link
Collaborator

slorber commented Aug 5, 2020

So, it is a bug introduced in this PR: #2331

The issue is on the Users page:
image

The v1 parser is Babylon v6, and v6 does not support React fragments. Replacing the fragment by a div or <React.Fragment> solves it.

I'm not going to upgrade Babylon in v1 but will release a fix soon so that v1 can be initialized without issue. Also will add some useful logs so that this kind of problem is easier to debug.

Will be fixed in #3213

@slorber
Copy link
Collaborator

slorber commented Aug 5, 2020

Release 1.14.6, seems to work now

@Josh-Cena Josh-Cena added v1 This issue is for Docusaurus 1 and removed status: needs triage This issue has not been triaged by maintainers labels Mar 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution v1 This issue is for Docusaurus 1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants