I currently have the the following issue when running a unit test using the Jest Vue cli plugin found here. https://www.npmjs.com/package/#vue/cli-plugin-unit-jest
Error I receive is Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of #babel/core, it is likely that somet
hing in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "#
babel/core" or "babel-core" to see what is calling Babel
I am using Yarn workspaces and would like to know the best way to force #vue/cli-plugin-unit-jest to use babel-core of version ^7.0.0-0
Related
Testcafe 1.10 doesn’t seem to run via Yarn 2, while it just works running the globally installed one manually. I get this output:
ERROR Error: testcafe-legacy-api tried to access read-file-relative, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.
Required package: read-file-relative (via "read-file-relative")
Required by: testcafe-legacy-api#npm:4.0.0 (via /data/Fichiers/Code/testcafe/.yarn/cache/testcafe-legacy-api-npm-4.0.0-ff97b69c8c-e4a891ec41.zip/node_modules/testcafe-legacy-api/lib/)
I can see that read-file-relative is listed as a dependency of testcafe, but not as a dependency of testcafe-legacy-api (https://yarnpkg.com/package/testcafe, https://yarnpkg.com/package/testcafe-legacy-api), which itself is a dependency of testcafe.
EDIT : PRs on both sides have been merged so it should work now or soon without using the workaround below.
Apparently testcafe and its dependency testcafe-legacy-api have several actual dependencies that are not listed in their dependencies listing.
As the documentation for .yarnrc.yml explains:
Some packages may have been specified incorrectly with regard to their dependencies - for example with one dependency being missing, causing Yarn to refuse it the access. The packageExtensions fields offer a way to extend the existing package definitions with additional information.
Adding this to my .yarnrc.yml and then running yarn install (or yarn) fixed it:
packageExtensions:
"testcafe#*":
dependencies:
"#babel/runtime": "*"
"#babel/plugin-transform-for-of": "*"
"testcafe-legacy-api#*":
dependencies:
"read-file-relative": "*"
"testcafe-hammerhead": "*"
Hello I am a beginner in React-native and below is my flowconfig file's version and I get an error with this version
[version]
^0.92.0
Is there a way to fix this error, I was trying to run debug mode in visual code for running react-native projects and to print console.log.
So far I am unsuccessful.
PS:- beginner in react-native
Change [version] in the .flowconfig to match the installed version, ^0.95.1
1. Check that the following tags match
package.json
"devDependencies": {
"flow-bin": "0.130.0"
}
.flowconfig
[version]
^0.130.0
2. Clean & Reinstall
If they match, this error can occur when your node_modules are out of sync with the version of flow-bin in your package.json. This can occur if you've changed branches recently or have have an older version in your node modules.
Try removing and reinstalling like this:
rm -rf node_modules/ && npm i
Instead of changing the flow version make it a ranged version. For example something like >=0.50.0 or simply remove the version altogether. You can read about that more in the flowconfig docs
I find that changing the flow version every time you face this problem to be a bad approach especially if you work with a team and each team member has a different version installed and they would commit their version into the .flowconfig file
I used vue-cli to create a vue app and then i added electron(4.0.0) via a plugin called vue-cli-plugin-electron-builder. Everything is ok and works properly.
The problem is with iohook which, as stated on their documentation, has prebuild versions for electron ABI <= 57 (in reality it's <= 64). It seems that on my project it automatically downloads and uses electron ABI(64) which is electron(3.0.0) (verified with node-abi).
electron(4.0.3/4) is ABI(69) (which is not supported). Judging by these circumstances i'm also considering that electron 4.0.0 has ABI(69) as well
iohook needs things specified in package.json [arch type, etc..] which i did specify.
iohook also wants me to npm run build but as of now it doesn't generate any build folder what so ever.
My solutions are:
Go back to electron 3.0.0
What are the differences between electron 3.0.0 and electron 4.0.x
Manually build iohook from source
Their documentation on manual building seems poor, at least for me. How do i actually do that? It's always throwing me errors / saying to cd in the lib's directory and npm run compile which doesn't work because arch type doesn't match.
As of now i want to manually build iohook.
UPDATE
I tried with electron 3.0.0 (barebones) and it's still throwing:
Error: Cannot find module 'F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\builds\electron-v64-win32-x64\build\Release\iohook.node'
at webpackEmptyContext (webpack:///./node_modules/iohook_sync?:2:10)
at eval (webpack:///./node_modules/iohook/index.js?:10:80)
at Object../node_modules/iohook/index.js (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:252:1)
at __webpack_require__ (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:20:30)
at eval (webpack:///./src/background.js?:15:16)
at Module../src/background.js (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:1395:1)
at __webpack_require__ (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:20:30)
at eval (webpack:///multi_./src/background.js?:1:18)
at Object.0 (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:1406:1)
at __webpack_require__ (F:\DOCS\OneDrive\Programming\NODE\type_analysis\dist_electron\index.js:20:30)
UPDATE 2
Doesn't work with electron 2.0.0 either...
I also added the cmake-js thing in package.json
"cmake-js": {
"runtime": "electron",
"runtimeVersion": "2.0.0"
}
Tried electron-rebuild -f -w iohook as well, didn't solve the problem either
Support for Electron v2+ is here now (try iohook version 0.4+). We are currently working on the Win32/64 support for electron 4. All other platforms are fine. You can follow the debug here : https://github.com/wilix-team/iohook/pull/157
I've googled many sites but cannot found a tutorial that actually works for react-native + flow type.
There was flow installation guide from react-native#0.22 document, but it's gone in react-native#0.46.
However, it comes up again in Running Tests and Contributing, I tested to run npm run flow but not working, and yet it doesn't say how to make it works. It's possibly been a missing part inside of react-native documentation.
What I need is to run flow correctly with react-native. Auto-check flow every time I reload the page with ⌘R would be the best.
I just finished covering half of our project by flow and we use RN 0.44.0.
The tricky part is: do you also want to know errors inside node_modules, someone says those errors are helpful.
Anyway, I disable the error in node_modules, and here is my .flowconfig:
[ignore]
<PROJECT_ROOT>/node_modules/.*
<PROJECT_ROOT>/flowLibs.js
.....
[include]
[libs]
./flowLibs.js
.....
[lints]
[options]
You should install flow first if you not setup correctly,
npm install --save-dev flow-bin
and also run this in you project root after install:
npm run flow init
If npm run flow init does not work, just add "flow": "flow" in npm scripts.
After init, put my .flowconfig in your project .flowconfig file.
Then create a js file flowLibs.js and if npm run flow check cause your any error like Module_Name. Required module not found
Write down code in flowLibs.js:
declare module 'Module_Name' { declare var exports: any; };
After that, you should be good to go with you project now.
BTW, don't forget add //#flow on the top of the file which you want to check type.
I found flowtype is built in with react-native#0.46+.
For react-native document, I think they should at least tell flowtype is already built in. And for the rest document ex: Testing Your Changes#flow, it won't work without flow-bin, they should mention that too.
To make flowtype of best use, I use it with Visual Studio Code.
Steps:
Install flow-bin globally, by npm i flow-bin -g.
Make sure your terminal is responsive to command flow.
Install vscode flow extension.
Set vscode workspace preference with "javascript.validate.enable": false, to disable default javascript validation, so flow validation can take place.
To access vscode preference, ALT+F,P,S for windows, ⌘+, for mac.
then you have flowtype installed with visual result with every key stroke:
Try this one:
Adding Flow to React Native
https://medium.com/react-native-training/getting-started-with-react-native-and-flow-d40f55746809
Hope this helps!
I recently wanted to reset a react-native project to most recent version, and so I initialised the seed project - "AwesomeProject"... The problem is that it comes with 19 flowtype errors "out of the box"
node_modules/react-native/Libraries/CustomComponents/NavigationExperimental/NavigationCardStackStyleInterpolator.js
lines:91,94,97,104,107,137,142,148
node_modules/react-native/Libraries/CustomComponents/NavigationExperimental/NavigationHeaderStyleInterpolator.js
lines:57,68,74,87,94
node_modules/react-native/Libraries/Experimental/WindowedListView.js
lines:629, 629, 665,665
node_modules/react-native/Libraries/Image/Image.ios.js
line:272
I am reluctant to make changes to these files as it may create knock on effects. Does anyone have a work around?
In general, whenever you want flow to ignore a file, you can just specify that file under the [ignore] section of your .flowconfig.
That said, I just react-native init'd a project, using react-native-cli 1.0.0 and react-native 0.29.1, and ran a flow server on the root of my project, and didn't get any errors.