node.js - ENOENT: no such file or directory, open 'node:stream' - Stack Overflow

we are upgrading from Jest 23 to 26seeing below error on running jest after the upgrade,even tried in

we are upgrading from Jest 23 to 26

seeing below error on running jest after the upgrade,

even tried install stream package and no luck with that. any help understanding why jest-runtime is not finding the package inside node modules

  ENOENT: no such file or directory, open 'node:stream'
    
          at Runtime.readFile (node_modules/jest-runner/node_modules/jest-runtime/build/index.js:1987:21)
          at Object.<anonymous> (node_modules/parse5-parser-stream/dist/cjs/index.js:4:23)

package.json

"devDependencies": {
    "babel-jest": "^26.0.0",
    "chai": "^4.1.2",
    "chai-enzyme": "^1.0.0-beta.1",
    "chai-jest-mocks": "^1.2.4",
    "compression-webpack-plugin": "^1.1.11",
    "copy-webpack-plugin": "^4.6.0",
    "enzyme": "^3.4.2",
    "enzyme-adapter-react-16": "^1.2.0",
    "eslint": "^4.19.1",
    "eslint-loader": "^4.0.2",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^6.1.1",
    "eslint-plugin-react": "^7.10.0",
    "eslint-plugin-react-hooks": "^1.6.1",
    "eslint-watch": "^4.0.2",
    "expose-loader": "^0.7.5",
    "extract-loader": "^3.0.0",
    "file-loader": "^2.0.0",
    "filewatcher-webpack-plugin": "^1.2.0",
    "gulp-nuget-restore": "^0.4.0",
    "jest": "^26.0.0",
    "jsx-loader": "^0.13.2",
    "mini-css-extract-plugin": "^0.4.4",
    "node-sass": "^5.0.0",
    "postcss-flexbugs-fixes": "^4.1.0",
    "postcss-preset-env": "^6.3.0",
    "redux-mock-store": "^1.5.4",
    "replace-in-file-webpack-plugin": "^1.0.6",
    "stream": "0.0.3",
    "uglifyjs-webpack-plugin": "^1.3.0",
    "webpack": "^4.20.2",
    "webpack-bundle-analyzer": "^2.13.1",
    "webpack-cli": "^3.1.1",
    "webpack-merge": "^4.1.4"
  }

babelrc

{
   "presets": [
       "@babel/react" , 
       "@babel/env" , 
   ],
   "plugins": [
       "@babel/plugin-proposal-class-properties"
   ]
}

Edit 1:

got past above error with - Jest Unit tests are failing

which helped pass some tests, but seeing another error with rest of the tests as below

TypeError: Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a Symbol.iterator method.

we are upgrading from Jest 23 to 26

seeing below error on running jest after the upgrade,

even tried install stream package and no luck with that. any help understanding why jest-runtime is not finding the package inside node modules

  ENOENT: no such file or directory, open 'node:stream'
    
          at Runtime.readFile (node_modules/jest-runner/node_modules/jest-runtime/build/index.js:1987:21)
          at Object.<anonymous> (node_modules/parse5-parser-stream/dist/cjs/index.js:4:23)

package.json

"devDependencies": {
    "babel-jest": "^26.0.0",
    "chai": "^4.1.2",
    "chai-enzyme": "^1.0.0-beta.1",
    "chai-jest-mocks": "^1.2.4",
    "compression-webpack-plugin": "^1.1.11",
    "copy-webpack-plugin": "^4.6.0",
    "enzyme": "^3.4.2",
    "enzyme-adapter-react-16": "^1.2.0",
    "eslint": "^4.19.1",
    "eslint-loader": "^4.0.2",
    "eslint-plugin-import": "^2.14.0",
    "eslint-plugin-jsx-a11y": "^6.1.1",
    "eslint-plugin-react": "^7.10.0",
    "eslint-plugin-react-hooks": "^1.6.1",
    "eslint-watch": "^4.0.2",
    "expose-loader": "^0.7.5",
    "extract-loader": "^3.0.0",
    "file-loader": "^2.0.0",
    "filewatcher-webpack-plugin": "^1.2.0",
    "gulp-nuget-restore": "^0.4.0",
    "jest": "^26.0.0",
    "jsx-loader": "^0.13.2",
    "mini-css-extract-plugin": "^0.4.4",
    "node-sass": "^5.0.0",
    "postcss-flexbugs-fixes": "^4.1.0",
    "postcss-preset-env": "^6.3.0",
    "redux-mock-store": "^1.5.4",
    "replace-in-file-webpack-plugin": "^1.0.6",
    "stream": "0.0.3",
    "uglifyjs-webpack-plugin": "^1.3.0",
    "webpack": "^4.20.2",
    "webpack-bundle-analyzer": "^2.13.1",
    "webpack-cli": "^3.1.1",
    "webpack-merge": "^4.1.4"
  }

babelrc

{
   "presets": [
       "@babel/react" , 
       "@babel/env" , 
   ],
   "plugins": [
       "@babel/plugin-proposal-class-properties"
   ]
}

Edit 1:

got past above error with - Jest Unit tests are failing

which helped pass some tests, but seeing another error with rest of the tests as below

TypeError: Invalid attempt to spread non-iterable instance. In order to be iterable, non-array objects must have a Symbol.iterator method.

Share Improve this question edited Jan 29 at 18:10 nari447 asked Jan 29 at 12:47 nari447nari447 9442 gold badges13 silver badges25 bronze badges 2
  • Please share node version. Are you importing 'node:stream' or is it just jest doing something internally? – sziraqui Commented Jan 29 at 14:41
  • @sziraqui - using node version - 14.21.1. not importing anything in the code, something jest calling internally. – nari447 Commented Jan 29 at 15:01
Add a comment  | 

1 Answer 1

Reset to default 1

found answer for original question with below

Jest Unit tests are failing

and and the follow up error with change to bablrc as advised in answers here -

TypeError: Invalid attempt to spread non-iterable instance

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745297224a4621218.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信