Cannot find module '@babel/plugin-transform-shorthand-properties'
See original GitHub issueLibrary works fine in 1.10.3. Fails on 2.1.0.
● Test suite failed to run
/node_modules/react-native-gesture-handler/lib/commonjs/handlers/gestures/GestureDetector.js: Cannot find module '@babel/plugin-transform-shorthand-properties'
Issue Analytics
- State:
- Created 2 years ago
- Reactions:8
- Comments:9 (2 by maintainers)
Top Results From Across the Web
@babel/plugin-transform-shorthand-properties - npm
Compile ES2015 shorthand properties to ES5. ... Start using @babel/plugin-transform-shorthand-properties in your project by running `npm i ...
Read more >babel/plugin-transform-shorthand-properties
NOTE: This plugin is included in @babel/preset-env ... npm install --save-dev @babel/plugin-transform-shorthand-properties.
Read more >How do I install node module @babel/plugin-transform-class ...
Notice the name change from "plugin-transform-class-properties" ... Searched for node-sass for babel 7.11.4 Found the fix here.
Read more >@babel/plugin-transform-shorthand-properties | Yarn - Yarn
Intro. Babel is a tool that helps you write code in the latest version of JavaScript. When your supported environments don't support certain...
Read more >babel/plugin-transform-shorthand-properties - npm package
@babel/plugin-transform-shorthand-properties · Compile ES2015 shorthand properties to ES5 For more information about how to use this package see README · Security.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think I’ve figured out the root cause of this issue (at least in my case).
The problem lies with the inconsistency in the versions of
babel
-related packages inyarn.lock
.To be specific,
metro-react-native-babel-transformer
requires@babel/core@^7.14.0
, but my projectpackage.json
requires@babel/core@7.16.5
. Just like the following require stack,So it might bring confusion to babel, causing it to complain about being unable to find
@babel/plugin-transform-shorthand-properties
.Simply downgrading
@babel/core
to^7.14.0
might not solve the problem, as things get complicated due to the fact thatreact-native-codegen
indirectly requires@babel/core@^7.1.6
. Fortunately, there are some workarounds:@babel/preset-env
and@babel/preset-typescript
to the dependencies (or devDependencies) list of the projectpackage.json
fileyarn.lock
and regenerate itFinally, if there have to be someone responsible for the issue, at least the responsibility does not lies with
react-native-gesture-handler
. Perhapsreact-native
can do something to handle this issue.It turns out that I have to install both
@babel/preset-env
and@babel/preset-typescript
as dependencies (or devDependencies) to make things work in my project.