question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing "babylon" and other dependencies?

See original GitHub issue

I am using this in a RN 0.61.5 project, and I’ve installed the project with:

npm install react-native-obfuscating-transformer --save-dev

When running npx react-native start, I get this error:

Loading dependency graph...Failed to construct transformer:  Error: Cannot find module 'babylon'
Require stack:
-/node_modules/react-native-obfuscating-transformer/dist/getMetroTransformer.js
-/node_modules/react-native-obfuscating-transformer/dist/obfuscatingTransformer.js
-/node_modules/react-native-obfuscating-transformer/dist/index.js
-/transformer.js
-/node_modules/metro/src/JSTransformer/worker.js
-/node_modules/metro/src/DeltaBundler/Transformer/getTransformCacheKey.js
-/node_modules/metro/src/DeltaBundler/Transformer.js
-/node_modules/metro/src/Bundler.js
-/node_modules/metro/src/IncrementalBundler.js
-/node_modules/metro/src/index.js
-/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/loadMetroConfig.js
-/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/runServer.js
-/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/server.js
-/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/index.js
-/node_modules/react-native/node_modules/@react-native-community/cli/build/index.js
-/node_modules/react-native/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:973:15)
    at Function.Module._load (internal/modules/cjs/loader.js:855:27)
    at Module.require (internal/modules/cjs/loader.js:1033:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/node_modules/react-native-obfuscating-transformer/dist/getMetroTransformer.js:6:15)
    at Module._compile (internal/modules/cjs/loader.js:1144:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
    at Module.load (internal/modules/cjs/loader.js:993:32)
    at Function.Module._load (internal/modules/cjs/loader.js:892:14)
    at Module.require (internal/modules/cjs/loader.js:1033:19)

After running npm i babylon --save-dev, I get:

Loading dependency graph...Failed to construct transformer:  Error: Cannot find module 'babel-traverse'
Require stack:
- /node_modules/react-native-obfuscating-transformer/dist/getMetroTransformer.js
- /node_modules/react-native-obfuscating-transformer/dist/obfuscatingTransformer.js
- /node_modules/react-native-obfuscating-transformer/dist/index.js
- /transformer.js
- /node_modules/metro/src/JSTransformer/worker.js
- /node_modules/metro/src/DeltaBundler/Transformer/getTransformCacheKey.js
- /node_modules/metro/src/DeltaBundler/Transformer.js
- /node_modules/metro/src/Bundler.js
- /node_modules/metro/src/IncrementalBundler.js
- /node_modules/metro/src/index.js
- /node_modules/react-native/node_modules/@react-native-community/cli/build/tools/loadMetroConfig.js
- /node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/runServer.js
- /node_modules/react-native/node_modules/@react-native-community/cli/build/commands/server/server.js
- /node_modules/react-native/node_modules/@react-native-community/cli/build/commands/index.js
- /node_modules/react-native/node_modules/@react-native-community/cli/build/index.js
- /node_modules/react-native/cli.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:973:15)
    at Function.Module._load (internal/modules/cjs/loader.js:855:27)
    at Module.require (internal/modules/cjs/loader.js:1033:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/node_modules/react-native-obfuscating-transformer/dist/getMetroTransformer.js:7:24)
    at Module._compile (internal/modules/cjs/loader.js:1144:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1164:10)
    at Module.load (internal/modules/cjs/loader.js:993:32)
    at Function.Module._load (internal/modules/cjs/loader.js:892:14)
    at Module.require (internal/modules/cjs/loader.js:1033:19)

My transformer.js is:

const obfuscatingTransformer = require("react-native-obfuscating-transformer");

module.exports = obfuscatingTransformer({
  /* options */
});

And my Metro Config:

module.exports = {
  transformer: {
    babelTransformerPath: require.resolve("./transformer"),
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
};

I see that Babylon is part of the dependencies: https://github.com/javascript-obfuscator/react-native-obfuscating-transformer/blob/master/package.json#L14 – but then again, there seem to be duplicates?

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:5
  • Comments:14

github_iconTop GitHub Comments

5reactions
Raymond-Coxcommented, Jan 27, 2020

Same issue here, same exact setup. Will continue digging and report back if I find anything.

EDIT: Try changing metro.config.js to the following:

module.exports = {
  transformer: {
    getTransformModulePath: () => {
      return require.resolve('./transformer');
    },
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
};
2reactions
mrcarjulcommented, Feb 8, 2020

add babylon and babel-traverse as dev dependencies.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Babylonjs-inspector type dependencies missing - Bugs
Hi ! From what I understood @types/react and @types/react-dom are currently within devDependencies of babylonjs-inspector package, ...
Read more >
Resolving missing dependencies - Zendesk help
Understanding missing dependencies ... A dependency is any reference in a business rule such as a trigger. It could be a group, an...
Read more >
depcheck | Yarn - Package Manager
Depcheck is a tool for analyzing the dependencies in a project to see: how each dependency is used, which dependencies are useless, and...
Read more >
Missing Gem Dependencies - ruby - Stack Overflow
I'm trying to use a different MD library. – master. Feb 18, 2015 at 1:19. Explanation of why ...
Read more >
Gloomhaven treasure 75 translation - Caritas Castellaneta
Jun 07, 2010 · Long-Lost Silent Films Return to America. ... This mod does not have any known dependencies other than the base...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found