Posted On January 13, 2022

How to remove flow issues in node modules?

Ghazal Ehsan 0 comments
Hut Explore >> Technology , Programming >> How to remove flow issues in node modules?
download

During run flow command, we were facing flow issues in node modules. Error is something like this:

Errors
Error: node_modules/bcryptjs/src/bower.json:4
4: “version”: /*?== VERSION */,
^ Unexpected token ,
Error: node_modules/strong-globalize/test/fixtures/extract013/intl/en/messages.json:2
2: “msgPredefined”: “This is a predefined message in a broken json
^ Unexpected token ILLEGAL
Found 42 errors
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] flow: `flow`
npm ERR! Exit status 2
npm ERR! 
npm ERR! Failed at the [email protected] flow script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ghazal/.npm/_logs/2017–10–31T06_14_39_009Z-debug.log

Step-by-step guide:

Following steps involved to remove flow issues:

  1. Create .flowconfig in project root folder, if it is not already created.
  2. Open .flowconfig file and write the following code.
[ignore]
.*/node_modules/*
[include]
[libs]
[lints]
[options]

This will ignore the flow errors from node modules.

After this run npm run flow , Now it will give new errors if you have import / require any node module in your project. Error is like below:

require modulesLaunching Flow server for /var/www/dukaan/dukaan-api-server
Spawned flow server (pid=6247)
Logs will go to /tmp/flow/zSvarzSwwwzSdukaanzSdukaan-api-server.log
Error: test/attribute.test.js:4
4: const chai = require('chai');
^^^^^^ chai. Required module not foundError: test/attribute.test.js:5
5: const mocha = require('mocha');
^^^^^^^ mocha. Required module not foundError: test/attribute.test.js:6
6: const chaiHttp = require('chai-http');
^^^^^^^^^^^ chai-http. Required module not foundFound 24 errors
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! [email protected] flow: `flow`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the [email protected] flow script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in:
npm ERR! /home/ghazal/.npm/_logs/2017-10-31T06_16_25_402Z-debug.log

To remove these errors, follow the following steps.

Step-by-step guide:

Following steps involved to remove require modules flow issues:

  1. Open terminal and go to root folder of project.
  2. Run the commands below
sudo npm install -g flow-typed
flow-typed create-stub [email protected]

Here mocha is the node module name. You have to write your own require modules name one by one.

https://medium.com/@ghazaltaimur27/how-to-remove-flow-issues-in-node-modules-629bb9f81c9e

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post

Change File upload limit in ngnix in AWS Server

When uploading image greater than 1 MB, it gives 413 Request entity too large error. Ngnix default…

Apple stops signing iOS 15.2, blocking downgrade from iOS 15.2.1

Apple stops signing iOS 15.2, blocking downgrade from iOS 15.2.1 Following the arrival of iOS…

How to add code in wordpress post?

How to add code in wordpress post? To add code to a WordPress post, you…