Reputation: 1070
This error starting showing up all of a sudden.
Node : v10.16.3
React native : 0.60.5
react-native-cli: 2.0.1
bundling failed: Error: Unable to resolve module
stream
from/Users/username/React Native/SampleApp/node_modules/browser-stdout/index.js
: Modulestream
does not exist in the Haste module map
It's giving error for this line :
var WritableStream = require('stream').Writable
I tried installing 'stream' via npm
npm install stream
Then other similar errors started showing up.
Upvotes: 9
Views: 8720
Reputation: 1591
My solution which worked for me was install readable-stream
and add alias in metro.config.js
file:
const config = {
resolver: {
extraNodeModules: {
...{your other things}
stream: require.resolve('readable-stream'),
},
},
};
Upvotes: 0
Reputation: 233
just install stream using npm install stream and run the project again.
Upvotes: -1
Reputation: 1953
One option is to use the client package readable-stream. If dependencies are requiring stream
, then i would suggest adding the following to your babel config as well.
yarn add readable-stream
yarn add -D babel-plugin-rewrite-require
babel.config.js
module.exports = {
// rest of config
plugins: [
// other plugins
[
'babel-plugin-rewrite-require',
{
aliases: {
stream: 'readable-stream',
},
},
],
],
};
Upvotes: 5