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.

cbor fails to import in expo/metro bundle (expo go IOS)

See original GitHub issue

I’m developing a React Native application and I cannot get this library to work under expo/metro. Simply adding import cbor from 'cbor'; causes the bundle to error out with Unhandled JS Exception: Invalid regular expression: invalid group specifier name no stack.

To reproduce:

expo init dummy  # minimal template
cd dummy
npm install cbor
npm install node-inspect-extracted
npm install stream
# Add "import cbor from 'cbor';" to App.js
expo start
# open bundle with expo go

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:23 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
hildjjcommented, Mar 15, 2021

Understanding their code let me simplify a few things. Current set of packages required:

  • bignumber.js (or set dynamicDepsInPackages to “reject”)
  • buffer
  • cbor
  • events
  • node-inspect-extracted
  • stream-browserify

No changes to babel.config.js necessary. Change metro.config.js to:

module.exports = {
  transformer: {
    assetPlugins: ['expo-asset/tools/hashAssetFiles'],
  },
  resolver: {
    extraNodeModules: {
      stream: require.resolve('stream-browserify'),
    },
  },
};
0reactions
hildjjcommented, Mar 18, 2021

Is this working enough that we can close the issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

IOS - Bundle Assets Error When Building Release (403)
We've published the application with expo export and hosting the content on S3. The asset links are accessible there with no 403. Debug...
Read more >
Expo and metro bundler: external module cannot resolve react ...
I get no error when the imported module does not import react. Here's the error: Unable to resolve module @babel/runtime/helpers/ ...
Read more >
Collibra Platform OSS Attribution File.txt
This Collibra product does not necessarily use all the open source software referred to below and may also only use portions of a...
Read more >
@expo/metro-config - npm
A Metro config for running React Native projects with the Metro bundler. Latest version: 0.5.2, last published: 9 days ago.
Read more >
News Cabra hgW - ALBA.Net
Www owais raza qadri audio naat com, Iphone 4s review ios 8, ... Lintukirpun purema, Default tab chrome download, Imported chocolates delhi, ...
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