6
votes

I'm trying to run react-native start (as all the other days, it works normally) and it gives me this error:

THE ERROR

Loading dependency graph...events.js:287
      throw er; // Unhandled 'error' event
      ^

Error: UNKNOWN: unknown error, lstat 'C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2\node_modules\jest-util\node_modules\.bin\mkdirp'
Emitted 'error' event on NodeWatcher instance at:
    at NodeWatcher.checkedEmitError (C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2\node_modules\sane\src\node_watcher.js:143:12)
    at Walker.emit (events.js:310:20)
    at C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2\node_modules\walker\lib\walker.js:52:12
    at FSReqCallback.oncomplete (fs.js:167:21) {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'lstat',
  path: 'C:\\Users\\OKR\\Desktop\\MeetUp App\\Development\\MeetUp2\\node_modules\\jest-util\\node_modules\\.bin\\mkdirp'
}

ERROR LOG

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2\node_modules\.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;c:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools;C:\Program Files\Java\jdk1.8.0_152\bin;C:\Program Files\nodejs\;C:\Users\OKR\AppData\Local\Microsoft\WindowsApps;C:\Users\OKR\AppData\Local\atom\bin;C:\Users\OKR\AppData\Local\Programs\Microsoft VS Code\bin;c:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools;C:\MinGW\bin;D:\Genymotion\tools;C:\Users\OKR\AppData\Roaming\npm
9 verbose lifecycle [email protected]~start: CWD: C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'react-native start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `react-native start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:310:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:310:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
18 verbose node v12.16.3
19 verbose npm  v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `react-native start`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

WHAT I'VE TRIED

  • Deleted node_modules packages and package-lock.json and run npm install. It still fails after many trials

  • Update node.js to the latest-recommended version: 12.16.3. Then repeat the above step and it still fails

  • Run npm cache clean ( gives error) and reapeat step 1 --> Fail

  • EDIT 1 I have tried react-native start --reset-cache and it gives the same error

  • EDIT 2 I've tried: npm cache clean --force and it gives me error:

npm ERR! code UNKNOWN
npm ERR! syscall unlink
npm ERR! path C:\Users\OKR\AppData\Roaming\npm-cache\_cacache\content-v2\sha512\30\b7\d403a3bea9ab8b0dbca6fa631982d5c21917c8c72428787e88295705b25c8e0c47bf12524dc2bd05a21437c46e02e872ba6e4dca60f3d7c0754993757935
npm ERR! errno -4094
npm ERR! UNKNOWN: unknown error, unlink 'C:\Users\OKR\AppData\Roaming\npm-cache\_cacache\content-v2\sha512\30\b7\d403a3bea9ab8b0dbca6fa631982d5c21917c8c72428787e88295705b25c8e0c47bf12524dc2bd05a21437c46e02e872ba6e4dca60f3d7c0754993757935'

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\OKR\AppData\Roaming\npm-cache\_logs\2020-05-26T13_16_06_204Z-debug.log

The logs

0 info it worked if it ends with ok 1 verbose cli [ 1 verbose cli 'C:\Program Files\nodejs\node.exe', 1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js', 1 verbose cli 'cache', 1 verbose cli 'clean', 1 verbose cli '--force' 1 verbose cli ] 2 info using [email protected] 3 info using [email protected] 4 warn using --force I sure hope you know what you are doing. 5 verbose npm-session ec09bc51399022bd 6 verbose stack Error: UNKNOWN: unknown error, unlink 'C:\Users\OKR\AppData\Roaming\npm-cache_cacache\content-v2\sha512\30\b7\d403a3bea9ab8b0dbca6fa631982d5c21917c8c72428787e88295705b25c8e0c47bf12524dc2bd05a21437c46e02e872ba6e4dca60f3d7c0754993757935' 7 verbose cwd C:\Users\OKR\Desktop\MeetUp App\Development\MeetUp2 8 verbose Windows_NT 10.0.17763 9 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "cache" "clean" "--force" 10 verbose node v12.16.3 11 verbose npm v6.14.4 12 error code UNKNOWN 13 error syscall unlink 14 error path C:\Users\OKR\AppData\Roaming\npm-cache_cacache\content-v2\sha512\30\b7\d403a3bea9ab8b0dbca6fa631982d5c21917c8c72428787e88295705b25c8e0c47bf12524dc2bd05a21437c46e02e872ba6e4dca60f3d7c0754993757935 15 error errno -4094 16 error UNKNOWN: unknown error, unlink 'C:\Users\OKR\AppData\Roaming\npm-cache_cacache\content-v2\sha512\30\b7\d403a3bea9ab8b0dbca6fa631982d5c21917c8c72428787e88295705b25c8e0c47bf12524dc2bd05a21437c46e02e872ba6e4dca60f3d7c0754993757935' 17 verbose exit [ -4094, true ]

(I can't put the above log in code format since Stack Overflow doesn't allow to)

  • EDIT 3: I've tried to run cmd in administrator mode but it throws the same error
  • EDIT 4: I've tried npm start and it gives me this error:
Loading dependency graph...events.js:287
      throw er; // Unhandled 'error' event
      ^

Error: UNKNOWN: unknown error, lstat 'C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\jest-util\node_modules\.bin\mkdirp'
Emitted 'error' event on NodeWatcher instance at:
    at NodeWatcher.checkedEmitError (C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\sane\src\node_watcher.js:143:12)
    at Walker.emit (events.js:310:20)
    at C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\walker\lib\walker.js:52:12
    at FSReqCallback.oncomplete (fs.js:167:21) {
  errno: -4094,
  code: 'UNKNOWN',
  syscall: 'lstat',
  path: 'C:\\Users\\OKR\\Desktop\\MeetUp_App\\Development\\MeetUp2\\node_modules\\jest-util\\node_modules\\.bin\\mkdirp'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-native start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\OKR\AppData\Roaming\npm-cache\_logs\2020-05-27T11_29_28_113Z-debug.log

The logs:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\dotnet\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\Git\cmd;c:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools;C:\Program Files\Java\jdk1.8.0_152\bin;C:\Program Files\nodejs\;C:\Users\OKR\AppData\Local\Microsoft\WindowsApps;C:\Users\OKR\AppData\Local\atom\bin;C:\Users\OKR\AppData\Local\Programs\Microsoft VS Code\bin;c:\Users\YOUR_USERNAME\AppData\Local\Android\Sdk\platform-tools;C:\MinGW\bin;D:\Genymotion\tools;C:\Users\OKR\AppData\Roaming\npm
9 verbose lifecycle [email protected]~start: CWD: C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2
10 silly lifecycle [email protected]~start: Args: [ '/d /s /c', 'react-native start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1  signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `react-native start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:310:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:310:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid [email protected]
15 verbose cwd C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.16.3
19 verbose npm  v6.14.5
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `react-native start`
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

  • EDIT 5: I've tried to run the command to upgrade react-native using npx react-native upgrade. And it gives this error:
info No version passed. Fetching latest...
info Fetching diff between v0.61.5 and v0.62.2...
info Applying diff...
warn Excluding files that exist in the template, but not in your project:

error Automatically applying diff failed. We did our best to automatically upgrade as many files as possible
warn Continuing after failure. Some of the files are upgraded but you will need to deal with conflicts manually
info Installing "[email protected]" and its peer dependencies...
error Command failed: npm install --save --save-exact [email protected] [email protected]
npm ERR! Cannot read property 'match' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\OKR\AppData\Roaming\npm-cache\_logs\2020-05-27T11_26_44_748Z-debug.log
. Run CLI with --verbose flag for more details.
Error: Command failed: npm install --save --save-exact [email protected] [email protected]
npm ERR! Cannot read property 'match' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\OKR\AppData\Roaming\npm-cache\_logs\2020-05-27T11_26_44_748Z-debug.log

    at makeError (C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\execa\index.js:174:9)
    at C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\execa\index.js:278:16
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async installDeps (C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\upgrade\upgrade.js:206:3)
    at async Object.upgrade [as func] (C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\react-native\node_modules\@react-native-community\cli\build\commands\upgrade\upgrade.js:345:9)
    at async Command.handleAction (C:\Users\OKR\Desktop\MeetUp_App\Development\MeetUp2\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:182:9)

My package.json

{
  "name": "MeetUp2",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "start": "react-native start",
    "test": "jest",
    "lint": "eslint ."
  },
  "dependencies": {
    "@eva-design/eva": "^1.4.0",
    "@mapbox/polyline": "^1.1.0",

    "@react-native-community/cameraroll": "^1.6.1",
    "@react-native-community/datetimepicker": "^2.3.2",
    "@react-native-community/google-signin": "^4.0.1",
    "@react-native-community/masked-view": "^0.1.10",
    "@react-native-firebase/admob": "^6.7.1",
    "@react-native-firebase/app": "^6.7.1",
    "@react-native-firebase/auth": "^6.7.1",
    "@react-native-firebase/firestore": "^6.7.1",
    "@react-native-firebase/storage": "^6.7.1",
    "@react-navigation/drawer": "^5.7.1",
    "@react-navigation/native": "^5.2.6",
    "@react-navigation/stack": "^5.3.1",

    "@ui-kitten/components": "^4.4.1",
    "axios": "^0.19.2",
    "lodash": "^4.17.15",
    "moment": "^2.25.3",
    "react": "16.9.0",
    "react-native": "0.61.5",
    "react-native-collapsingtoolbar": "^1.0.3",

    "react-native-device-info": "^5.5.7",

    "react-native-fbsdk": "^1.1.2",
    "react-native-geolocation-service": "^4.0.1",
    "react-native-gesture-handler": "^1.6.1",

    "react-native-get-random-values": "^1.4.0",
    "react-native-image-picker": "^2.3.1",
    "react-native-keychain": "^6.0.0",

    "react-native-maps": "^0.27.1",
    "react-native-modal-datetime-picker": "^8.6.0",
    "react-native-paper": "^3.10.1",
    "react-native-reanimated": "^1.8.0",
    "react-native-redash": "^14.0.4",
    "react-native-safe-area-context": "^0.7.3",
    "react-native-screens": "^2.7.0",
    "react-native-share": "^3.3.2",
    "react-native-svg": "^12.1.0",
    "react-native-tab-view": "^2.14.0",
    "react-native-vector-icons": "^6.6.0",
    "react-native-view-shot": "^3.1.2",
    "react-navigation-header-buttons": "^3.0.5",
    "react-redux": "^7.2.0",
    "redux": "^4.0.5",

    "redux-persist": "^6.0.0",
    "redux-thunk": "^2.3.0",
    "rn-fetch-blob": "^0.12.0",
    "uuid": "^8.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.9.6",
    "@babel/runtime": "^7.9.6",
    "@react-native-community/eslint-config": "^0.0.7",
    "babel-jest": "^25.5.1",
    "eslint": "^6.8.0",
    "jest": "^25.5.4",
    "jetifier": "^1.6.5",
    "metro-react-native-babel-preset": "^0.59.0",
    "react-test-renderer": "16.9.0"
  },
  "jest": {
    "preset": "react-native"
  }
}

PLEASE HELP ME

1
Have you tried clearing your Metro and react-native caches? Try watchman watch-del-all && react-native start --reset-cacheAbe
I think it might be a permission issue that is preventing as your error log shows at line 11. Check the permission.Yogesh Aggarwal
Thanks for the comment @Yogesh. Can you please tell me what is that permission for and where can I check it?Mark
Please paste your package.jsonEjaz
Thanks for the comment @Ejaz. I've added the package.jsonMark

1 Answers

6
votes

Looks like the issue is with the npm cache. Try the following solution:

Run the command: npm cache verify

If you get errors then run: npm cache clear --force

Right Click on C: > Properties > Tools Tab.

Select Check or Check-now under Error Checking menu.

Reboot your PC after the process is completed.