Skip to content
New issue

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

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

Already on GitHub? # to your account

SyntaxError: Unexpected token: name (context) #3929

Closed
ukozdan opened this issue Feb 8, 2018 · 5 comments
Closed

SyntaxError: Unexpected token: name (context) #3929

ukozdan opened this issue Feb 8, 2018 · 5 comments

Comments

@ukozdan
Copy link

ukozdan commented Feb 8, 2018

Description

Trying to build fresh project as per "Get Started" docs

Environment

Gatsby version: 1.1.37
Node.js version: 9.4.0
Operating System: Windows 10 Enterprise

File contents (if changed):

No changes to contents.

Actual result

What happened.

`$ gatsby build
success delete html files from previous builds — 0.017 s
success open and validate gatsby-config.js — 0.005 s
success copy gatsby files — 0.047 s
success onPreBootstrap — 0.012 s
success source and transform nodes — 0.116 s
success building schema — 0.372 s
success createLayouts — 0.014 s
success createPages — 0.024 s
success createPagesStatefully — 0.028 s
success onPreExtractQueries — 0.004 s
success update schema — 0.122 s
success extract queries from components — 0.074 s
success run graphql queries — 0.067 s
success write out page data — 0.013 s
success write out redirect data — 0.002 s
success onPostBootstrap — 0.001 s

info bootstrap finished - 4.937 s

success Building CSS — 7.212 s

error Generating JavaScript bundles failed

Error: component---src-templates-blog-post-js-b29bd044b77c466ea753.js from UglifyJs
SyntaxError: Unexpected token: name (context) [./~/striptags/src/striptags.js:26,0]`

What should happen?

Steps to reproduce

1.

2.

3.

...

@KyleAMathews
Copy link
Contributor

Looks like a duplicate of #3780 — could you check if striptags is shipping es6 code?

@mathieuforest
Copy link

Answer here: https://stackoverflow.com/questions/46495399/striptags-npm-causes-webpack-babel-react-es6-compile-error

@larvinloy
Copy link

Explicitly specifying striptag version gives this error during build:

GraphQL Error There was an error while compiling your site's GraphQL queries. Error: Cannot use GraphQLSchema "[object Object]" from another module or realm.

error Building static HTML for pages failed


  22 |
  23 |   description(body) {
> 24 |     let test = body.replace(/<blockquote>/g, '<blockquote class="blockquote">')
     |                     ^
  25 |     if (test.match('<!--more-->')) {
  26 |       test = test.split('<!--more-->')
  27 |       if (typeof test[0] !== 'undefined') {


  WebpackError: Cannot read property 'replace' of undefined

@larvinloy
Copy link

Okay, so just changing striptag version to 2.2.1, as suggested by @mathieuforest didn't work. I had to explicitly specify gatsby version as 1.9.215.

@KyleAMathews
Copy link
Contributor

Due to the high volume of issues, we're closing out older ones without recent activity. Please open a new issue if you need help!

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants