Enis Ismaili
Enis Ismaili

Reputation: 171

error: bundling failed: ReferenceError: SHA-1 for file index.js

react-native: 0.57.0 yarn : 1.9.4 nodejs: 9.10.1

react-native run-android give me this error:

[android, dev] ..\..\../index.js ░░░░░░░░░░░░░░░░ 0.0% (0/1)::ffff:127.0.0.1 - - [14/Sep/2018:07:12:00 +0000] "GET /index.delta?platform=android&dev=true&minify=false HTTP/1.1" 500 - "-" "okhttp/3.10.0"
error: bundling failed: ReferenceError: SHA-1 for file c:\wamp64\www\React\hello1\index.js is not computed
    at DependencyGraph.getSha1 (c:\wamp64\www\React\hello1\node_modules\metro\src\node-haste\DependencyGraph.js:238:119)
    at c:\wamp64\www\React\hello1\node_modules\metro\src\Bundler.js:168:56
    at Generator.next (<anonymous>)
    at step (c:\wamp64\www\React\hello1\node_modules\metro\src\Bundler.js:11:657)
    at c:\wamp64\www\React\hello1\node_modules\metro\src\Bundler.js:11:817
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:118:7)

Upvotes: 12

Views: 23212

Answers (5)

Vishwas.jsx
Vishwas.jsx

Reputation: 1

rm-rf node_modules && npm install && npm start
cd ios && pod install 

Uninstall the applications installed on the devices and reinstall the app.

It worked for me :)

Upvotes: 0

ItSNeverLate
ItSNeverLate

Reputation: 729

mac users: open terminal and follow:

1.npm uninstall -g react-native-cli

2.cd 3.cd .npm-global 4.cd bin 5.rm -rf react-native

6.npm install -g react-native-cli

Notice: if you are a Windows user go to your user folder and delete "react-native" folder instead of steps 2..5

Upvotes: 1

SONGJP
SONGJP

Reputation: 404

i just try:

watchman watch-del-all && rm -rf node_modules/ && yarn install && yarn run dev

and in my case, i uninstall and reinstall my app on emulator, then it works

Upvotes: 1

Gil
Gil

Reputation: 69

I used

npm install
npm audit fix

and then on different consoles

npx react-native start

Upvotes: 4

Florin Dobre
Florin Dobre

Reputation: 10232

That looks like an issue related to metro.

Try to close console and in the project folder run:

rm -rf $TMPDIR/react-* && rm -rf $TMPDIR/metro-* && rm -rf $TMPDIR/haste-* && watchman watch-del-all && rm -rf node_modules/ && npm install && npm start -- --reset-cache

then run react-native run-android

For windows cleaning cache should be something like this:

del %appdata%\Temp\react-* & del %appdata%\Temp\metro-* & del %appdata%\Temp\haste-* & del node_modules & npm install & watchman watch-del-all & npm start -- --reset-cache (I haven't tried it on windows, probably for windows best option to remove node_modules would be to install rimraf)

If it still doesn't work check package.json and .babelrc. You should have something like this:

"metro-react-native-babel-preset": "^0.45.0", and .babelrc configuration:

{
    "presets": ["module:metro-react-native-babel-preset"]
}

Upvotes: 20

Related Questions