Skip to content

'No such file or directory' error when applying patch to react-native #139

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tbcshifter opened this issue Apr 23, 2019 · 10 comments
Closed

Comments

@tbcshifter
Copy link

I'm encountering the same error from #82 in 6.1.2 running patch-package react-native.

patch-package 6.1.2
• Creating temporary folder
• Installing [email protected] with npm
• Diffing your files with clean files
{ Error: ENOENT: no such file or directory, scandir '/var/folders/pn/__9t3jkx0y99dk28z07wp_pr0000gn/T/tmp-56329nwKmzZ769rP/node_modules/react-native'
    at Object.fs.readdirSync (fs.js:904:18)
    at Object.klawSync [as default] (/Users/andrew/.nvm/versions/node/v8.11.4/lib/node_modules/patch-package/node_modules/klaw-sync/klaw-sync.js:13:25)
    at Object.removeIgnoredFiles (/Users/andrew/.nvm/versions/node/v8.11.4/lib/node_modules/patch-package/dist/filterFiles.js:10:24)
    at Object.makePatch (/Users/andrew/.nvm/versions/node/v8.11.4/lib/node_modules/patch-package/dist/makePatch.js:89:23)
    at /Users/andrew/.nvm/versions/node/v8.11.4/lib/node_modules/patch-package/dist/index.js:48:25
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/andrew/.nvm/versions/node/v8.11.4/lib/node_modules/patch-package/dist/index.js:47:22)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
  errno: -2,
  code: 'ENOENT',
  syscall: 'scandir',
  path: '/var/folders/pn/__9t3jkx0y99dk28z07wp_pr0000gn/T/tmp-56329nwKmzZ769rP/node_modules/react-native' }
/Users/andrew/.nvm/versions/node/v8.11.4/lib/node_modules/patch-package/dist/makePatch.js:150
        throw e;
        ^

Error: ENOENT: no such file or directory, scandir '/var/folders/pn/__9t3jkx0y99dk28z07wp_pr0000gn/T/tmp-56329nwKmzZ769rP/node_modules/react-native'
    at Object.fs.readdirSync (fs.js:904:18)
    at Object.klawSync [as default] (/Users/andrew/.nvm/versions/node/v8.11.4/lib/node_modules/patch-package/node_modules/klaw-sync/klaw-sync.js:13:25)
    at Object.removeIgnoredFiles (/Users/andrew/.nvm/versions/node/v8.11.4/lib/node_modules/patch-package/dist/filterFiles.js:10:24)
    at Object.makePatch (/Users/andrew/.nvm/versions/node/v8.11.4/lib/node_modules/patch-package/dist/makePatch.js:89:23)
    at /Users/andrew/.nvm/versions/node/v8.11.4/lib/node_modules/patch-package/dist/index.js:48:25
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/andrew/.nvm/versions/node/v8.11.4/lib/node_modules/patch-package/dist/index.js:47:22)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)```
@ds300
Copy link
Owner

ds300 commented Apr 24, 2019

Hi 👋 Thanks for the report! I'm going to try to look into this on Friday.

@ds300
Copy link
Owner

ds300 commented Apr 27, 2019

Hello again! I haven't been able to reproduce this despite using the same versions of node and react-native. Any chance you could provide a repo on which you encounter the problem?

@tbcshifter
Copy link
Author

Unfortunately, this is on a private repo. However, it was an Expo project ejected to Expo kit. I was able to work around the issue by creating my own patch file and then using this package to create a patch file for a different module to figure out the file format and then convert my manual patch into the correct file format.

@ds300
Copy link
Owner

ds300 commented May 1, 2019

I was able to work around the issue by creating my own patch file and then using this package to create a patch file for a different module to figure out the file format and then convert my manual patch into the correct file format.

hahah, woah, kudos!

I'll try following the same steps with expo and report back.

@guitoof
Copy link

guitoof commented Aug 11, 2019

Hello there, any luck on this issue ?

I am having the same issue patching react-native 0.56 with the following patch in react-native/local-cli/runIOS/findMatchingSimulator.js :

if (
      !version.startsWith('iOS') &&
      !version.startsWith('tvOS')
    ) {

replaced by:

if (
      !version.startsWith('com.apple.CoreSimulator.SimRuntime.iOS') &&
      !version.startsWith('com.apple.CoreSimulator.SimRuntime.tvOS')
    ) {

@vicki15
Copy link

vicki15 commented Oct 30, 2019

+1 I am also seeing this trying to patch react-native with patch-package version 6.1.2

@bvigerzi
Copy link

bvigerzi commented Mar 4, 2020

For those still having issues, upgrading to patch-package version 6.2.1 fixed it for me

@ds300
Copy link
Owner

ds300 commented Mar 4, 2021

Gonna close this, the problem seems to be gone.

@ds300 ds300 closed this as completed Mar 4, 2021
@linus-komnick
Copy link

I get the same error:

npx patch-package react-native-pjsip
patch-package 6.4.7
• Creating temporary folder
• Installing [email protected] with npm
• Diffing your files with clean files
Error: ENOENT: no such file or directory, scandir '/var/folders/q1/vl783mk95bs57w4c6_9mpm0c0000gp/T/tmp-22021VVVDAe3U9tbo/node_modules/react-native-pjsip'
    at Object.readdirSync (fs.js:1043:3)
    at Object.klawSync [as default] (/Users/linuskomnick/Noloni/node_modules/klaw-sync/klaw-sync.js:13:25)
    at Object.removeIgnoredFiles (/Users/linuskomnick/Noloni/node_modules/patch-package/dist/filterFiles.js:11:24)
    at Object.makePatch (/Users/linuskomnick/Noloni/node_modules/patch-package/dist/makePatch.js:121:23)
    at /Users/linuskomnick/Noloni/node_modules/patch-package/dist/index.js:52:25
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/linuskomnick/Noloni/node_modules/patch-package/dist/index.js:51:22)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/var/folders/q1/vl783mk95bs57w4c6_9mpm0c0000gp/T/tmp-22021VVVDAe3U9tbo/node_modules/react-native-pjsip'
}
/Users/linuskomnick/Noloni/node_modules/patch-package/dist/makePatch.js:218
        throw e;
        ^

Error: ENOENT: no such file or directory, scandir '/var/folders/q1/vl783mk95bs57w4c6_9mpm0c0000gp/T/tmp-22021VVVDAe3U9tbo/node_modules/react-native-pjsip'
    at Object.readdirSync (fs.js:1043:3)
    at Object.klawSync [as default] (/Users/linuskomnick/Noloni/node_modules/klaw-sync/klaw-sync.js:13:25)
    at Object.removeIgnoredFiles (/Users/linuskomnick/Noloni/node_modules/patch-package/dist/filterFiles.js:11:24)
    at Object.makePatch (/Users/linuskomnick/Noloni/node_modules/patch-package/dist/makePatch.js:121:23)
    at /Users/linuskomnick/Noloni/node_modules/patch-package/dist/index.js:52:25
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/Users/linuskomnick/Noloni/node_modules/patch-package/dist/index.js:51:22)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32) {
  errno: -2,
  syscall: 'scandir',
  code: 'ENOENT',
  path: '/var/folders/q1/vl783mk95bs57w4c6_9mpm0c0000gp/T/tmp-22021VVVDAe3U9tbo/node_modules/react-native-pjsip'
}

Any ideas what might be causing it?

@linus-komnick
Copy link

The solution on issue 288 worked for me:
#288

I assume that the reason for this error was how I added the library in package.json.
I added it like so:
"react-native-pjsip": "git+https://github.com/datso/react-native-pjsip.git"

instead of like so
"react-native-pjsip": "^2.8.0"

What I did to fix this is go to Go to npm_modules/patch-package/dist/makePatch.js
Then replace the fs_extra_1.writeFileSync() function on line 50 with:

fs_extra_1.writeFileSync(tmpRepoPackageJsonPath, JSON.stringify({"dependencies":{"react-native-pjsip":"git+https://github.com/datso/react-native-pjsip.git"},"resolutions":{}}));

You'll have to replace "react-native-pjsip":"git+https://github.com/datso/react-native-pjsip.git" with whatever you're using in your package.json file!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants