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

jest error in Node version over 11.11 #6591

Closed
micalgenus opened this issue Mar 7, 2019 · 38 comments
Closed

jest error in Node version over 11.11 #6591

micalgenus opened this issue Mar 7, 2019 · 38 comments

Comments

@micalgenus
Copy link

PS. I do not speak English well. Please understand.

Is this a bug report?

Yes

Did you try recovering your dependencies?

yes / Initialized project with npx create-react-app my-project

Which terms did you search for in User Guide?

jest, jest version

Environment

$ npx create-react-app --info
npx: installed 63 in 8.392s

Environment Info:

System:
OS: Linux 4.4 Ubuntu 18.04.2 LTS (Bionic Beaver)
CPU: x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Binaries:
Node: 11.11.0 - ~/.nvm/versions/node/v11.11.0/bin/node
Yarn: 1.13.0 - /usr/bin/yarn
npm: 6.7.0 - ~/.nvm/versions/node/v11.11.0/bin/npm
npmPackages:
react: ^16.8.4 => 16.8.4
react-dom: ^16.8.4 => 16.8.4
react-scripts: 2.1.8 => 2.1.8
npmGlobalPackages:
create-react-app: Not Found

Steps to Reproduce

  1. install node version 11.11. (only over 11.11. There is no problem with other versions.)
  2. npx create-react-app myproject && cd myproject
  3. yarn test # this step error

Expected Behavior

Currently, the LTS version of node.js is 10, but will change from 2019-04-01 to version 11. That's why I think we need to fix the problem.

This problem has been fixed as follows after jestjs/jest@800f2f8 (v24.2.0-alpha.0).

newProcess[Symbol.toStringTag] = 'process';

modify to

 try {
    // This fails on Node 12, but it's already set to 'process'
    newProcess[Symbol.toStringTag] = 'process';
  } catch (e) {
    // Make sure it's actually set instead of potentially ignoring errors
    if (newProcess[Symbol.toStringTag] !== 'process') {
      e.message =
        'Unable to set toStringTag on process. Please open up an issue at https://github.com/facebook/jest\n\n' +
        e.message;

      throw e;
    }
  }

I used the 10.15.3 node and tried the 24.3.0 Jest. As a result, it worked fine. But I have not tested it for other versions of the node.

Actual Behavior

$ CI=true yarn test
yarn run v1.13.0
$ react-scripts test
FAIL src/App.test.js
  ● Test suite failed to run

    TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<process>'

      at exports.default (node_modules/jest-util/build/create_process_object.js:15:34)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        3.291s
Ran all test suites.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

The same is true without "CI=true".

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

moshfeu added a commit to Coding-Coach/find-a-mentor that referenced this issue Mar 7, 2019
@LesterLyu
Copy link

same here.

@jmarlow4
Copy link

jmarlow4 commented Mar 7, 2019

I'm getting the same error

@viktorlarsson
Copy link

Experiencing the same on node@latest, downgrading to node 10.6.0 makes everything fine and dandy.

@huxaiphaer
Copy link

huxaiphaer commented Mar 8, 2019

Me too the same error. Hey @viktorlarsson what if reactjs ?

@soer7022
Copy link

soer7022 commented Mar 8, 2019

Got the same error on the latest node image

@CaptainJojo
Copy link

Same here

kevindew added a commit to alphagov/paste-html-to-govspeak that referenced this issue Mar 8, 2019
This is to resolve a bug with the latest version of Node and Jest see:
facebook/create-react-app#6591
kevindew added a commit to alphagov/paste-html-to-govspeak that referenced this issue Mar 8, 2019
This is to resolve a bug with the latest version of Node and Jest see:
facebook/create-react-app#6591
@someden
Copy link

someden commented Mar 8, 2019

There is no error with node v11.10.1, but it is with v11.11.0
Example v11.10.1:

npx create-react-app my-app
cd my-app
docker run -it --rm -v $(PWD):$(PWD) -w $(PWD) node:11.10.1-alpine yarn test

 PASS  src/App.test.js (13.661s)
  ✓ renders without crashing (48ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        20.784s

Example v11.11.0:

npx create-react-app my-app
cd my-app
docker run -it --rm -v $(PWD):$(PWD) -w $(PWD) node:11.11.0-alpine yarn test

 FAIL  src/App.test.js
  ● Test suite failed to run

    TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<process>'

      at exports.default (node_modules/jest-util/build/create_process_object.js:15:34)

Test Suites: 1 failed, 1 total
Tests:       0 total
Snapshots:   0 total
Time:        5.643s

@DavidODonovan
Copy link

same here

@dbenchi
Copy link

dbenchi commented Mar 8, 2019

Same here

Thirosue pushed a commit to Thirosue/sample-vuejs-front that referenced this issue Mar 8, 2019
    TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<process>'
      at exports.default (node_modules/jest-util/build/create_process_object.js:15:34)
@Marjona6
Copy link

Marjona6 commented Mar 8, 2019

Please fix this :(

Thirosue pushed a commit to Thirosue/sample-vuejs-front that referenced this issue Mar 8, 2019
    TypeError: Cannot assign to read only property 'Symbol(Symbol.toStringTag)' of object '#<process>'
      at exports.default (node_modules/jest-util/build/create_process_object.js:15:34)

fix:
kevindew added a commit to alphagov/paste-html-to-govspeak that referenced this issue Mar 8, 2019
This is to resolve a bug with the latest version of Node and Jest see:
facebook/create-react-app#6591
@mricharz
Copy link

mricharz commented Mar 8, 2019

If you need to get this to work with node 11.11 and you cannot downgrade...

It is already fixed with newer jest version.
You can upgrade your own jest version besides create-react-app by installing jest-util@^23.4.0
Also you have to create a .env-File and to bypass the Preflight-Check.
echo "SKIP_PREFLIGHT_CHECK=true" >> .env

The complete cmd that solves the issue for myself is:
echo "SKIP_PREFLIGHT_CHECK=true" >> .env && npm i jest-util@^23.4.0 --save-dev

Until create-react-app has updated to newer jest-version, we can remove jest from our package.json and also reactivate this skipped preflight-check.

tejasbubane added a commit to tejasbubane/xjavascript that referenced this issue Mar 8, 2019
Latest travis breaks for node v11.11 with jest: facebook/create-react-app#6591
tejasbubane added a commit to tejasbubane/xjavascript that referenced this issue Mar 8, 2019
Latest travis breaks for node v11.11 with jest: facebook/create-react-app#6591
tejasbubane added a commit to exercism/javascript that referenced this issue Mar 8, 2019
@soer7022
Copy link

soer7022 commented Mar 8, 2019

if you use gitlab CI you can change image: node:latest into image: node:10.6.0

@Marjona6
Copy link

Marjona6 commented Mar 8, 2019

What worked for me was changing the version of Jest to 24.3.0. I also had to remove the lockfiles and reinstall before tests passed again on Travis. Hope this helps.

@FezVrasta
Copy link
Contributor

FezVrasta commented Mar 8, 2019

node@11.10.0 works fine, you don't need to downgrade to 10.6. The one with problems is node@11.11.0

@meeroslav
Copy link

What worked for me was changing the version of Jest to 24.3.0. I also had to remove the lockfiles and reinstall before tests passed again on Travis. Hope this helps.

As @Marjona6 stated it's fixed since version 24.3.0 so this issue should be closed.

@goldo
Copy link

goldo commented Mar 8, 2019

its not fixed in create-react-app since it doesn't bring jest 24 with it. It should be "awaiting" for this PR to be merged: #6278

@jonraem
Copy link

jonraem commented Mar 12, 2019

OK, my problem was that my bitbucket-pipelines.yml was using an unspecified version of alpine, which selects the latest one by default. It was a simple fix at the end and a silly overlooked mistake on my part. In other words I changed images with node:alpine to node:10.15-alpine.

@FezVrasta
Copy link
Contributor

Hey guys, lot of people are subscribed to this issue to be warned when a fix gets released. Please may you refrain from posting all your very own personal solutions that explain how did you downgrade your Docker images to use node <11.11 please?

snewcomer pushed a commit to snewcomer/cldr-compact-number that referenced this issue Mar 12, 2019
* Fix formatting and linting.

In first place, let me apologize. I needed to fix the Finnish formatting
but linting got into my editor's way so this is the complete list of
changes:

- Fix formatting for a few languages. Some languages include a dot in
the short format and in the data we get that dot surrounded by single
quotes. This is the main reason for this PR.
- Make the project pass its linting rules.
- Make CI check linting.
- Fix path in tslint.json to properly exclude test/locale-data.ts
- Add test/locale-data.ts to .prettierignore

* Fix versions of node to use

Jest is having a problem with latest unstable node (11.11.0) facebook/create-react-app#6591 so trying to set specific supported versions to fix travis

* Fix specifying versions
oliverlaz added a commit to netceteragroup/react-message-source that referenced this issue Mar 12, 2019
mesknock added a commit to mesknock/knock-syndication-exercise that referenced this issue Mar 13, 2019
jahe added a commit to jahe/fountain-gist-viewer that referenced this issue Mar 13, 2019
cds-amal added a commit to trufflesuite/drizzle-legacy that referenced this issue Mar 14, 2019
This is a temporary solution to unblock our release.
See this SO: https://goo.gl/dpWurj

The correct solution is to update to the latest Jest, however it looks
like it may require a bump and reconfig of babel/babel-plugins.

```
 FAIL  test/web3.test.js
  ● Test suite failed to run

    TypeError: this.setDynamic is not a function

      at PluginPass.pre (node_modules/babel-plugin-transform-runtime/lib/index.js:31:12)
      at transformFile (node_modules/@babel/core/lib/transformation/index.js:78:27)
      at runSync (node_modules/@babel/core/lib/transformation/index.js:45:3)
      at transformSync (node_modules/@babel/core/lib/transform.js:43:38)
      at ScriptTransformer.transformSource (node_modules/@jest/transform/build/ScriptTransformer.js:367:35)
      at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:437:40)
      at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:493:19)
```

Relevant Jest issue: facebook/create-react-app#6591
jperasmus added a commit to flamelink/flamelink-js-sdk that referenced this issue Mar 15, 2019
twocathouse pushed a commit to twocathouse/giphy-browser that referenced this issue Mar 16, 2019
Why not v11.11.0?

Because there's a standing issue with Jest:
facebook/create-react-app#6591
Reeywhaar added a commit to Reeywhaar/remark that referenced this issue Mar 17, 2019
@ldco2016
Copy link

None of the solutions in this thread have helped me, so yes, please refrain from posting what personally worked for you until a solution exists that works for everybody, this is frustrating.

@soer7022
Copy link

None of the solutions in this thread have helped me, so yes, please refrain from posting what personally worked for you until a solution exists that works for everybody, this is frustrating.

How are you supposed to know if it works for everyone or not?

@ianschmitz
Copy link
Contributor

We've released an alpha of create-react-app 3.0. Head on over to #6475 for instructions to install the latest alpha build which includes Jest 24. Let us know if it solves this issue!

@yurtaev
Copy link

yurtaev commented Mar 18, 2019

@ianschmitz Yes, it solved the problem 👍

@yurtaev
Copy link

yurtaev commented Mar 19, 2019

node 11.12 fixed it

@nartoland
Copy link

Ok

@ianschmitz
Copy link
Contributor

Closing as it sounds like this is resolved in Node 11.12

webmaster128 pushed a commit to webmaster128/web3x that referenced this issue Mar 21, 2019
Before we got the same error es described in
facebook/create-react-app#6591 when node.js
v11.11.0 was used.
xf00f pushed a commit to xf00f/web3x that referenced this issue Mar 23, 2019
* Upgrade jest to allow running tests with node.js 11.11

Before we got the same error es described in
facebook/create-react-app#6591 when node.js
v11.11.0 was used.

* Remove unused TxDeploy import

* Rebuild example projects from local web3x build
@lock lock bot locked and limited conversation to collaborators Mar 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.