yoga: Invalid asm.js: Unexpected token - yoga-layout-prebuilt

Report

  • [x ] I have searched for the error message in existing issues and this is not a duplicate

There are a bunch of people over on react-pdf that are seeing this issue.

Issues and Steps to Reproduce

Very first message In the console when running a create-react-app with the react-pdf code using npm start there is a cryptic message in the Chrome console log (during the react import/build process?)

Invalid asm.js: Unexpected token .../app/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:5503

My environment is pretty much a vanilla create react app.

Tracked it down to the import statement: import { PDFViewer, Document, Page, Text, View, StyleSheet } from '@react-pdf/renderer'

Expected Behavior

No warning from yoga-layout in the console.

Actual Behavior

Console message. Generates the PDF just fine.

Link to Code

Sorry, I tried to reproduce in https://codesandbox.io but it fails to import the PDF library. It can be setup pretty easily with vanilla create-react-app and add the code in the readme at https://github.com/diegomura/react-pdf

Environment

OS: Windows Browser chrome React-pdf version 1.5.6

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 37
  • Comments: 18 (1 by maintainers)

Most upvoted comments

Here from react-pdf. We are getting this issue as well. Would be great to see it resolved.

Jumping in as well from react-pdf using Jest specifically; would be incredible to have this fixed

Same here. React-PDF. Seeing this issue too.

Invalid asm.js: Unexpected token

Not a clean error, but I found that printing text inside a View component instead of a Text component triggered this error.

Bumping this. At least what does it mean?

Bumping this.

Bumpity Bump Bump Bump 😃

10 months on since the last comment on this issue, also here from @react-pdf/renderer and this is still an issue in my jest output. React 16, @react-pdf/render v2.3.0 Would love to see this go away …

Bump!

I just found this after creating an issue against react-pdf for creating errors in Jest output: https://github.com/diegomura/react-pdf/issues/1627

For that issue I created a minimal reproduction repo: https://github.com/cduff/react-pdf-linking-failure

In my scenario the error was the variable “ib” used everywhere in nbind.js It was created as const and is used to set the initial value of many other variables. In my first fix I just replaced “ib;” and “ib,” by the initial ib value: T(0) -> “T(0);” and “T(0),” respectively, to set the initial value directly on each variable.