ENOENT: no such file or directory, stat 'node_modules/fsevents/node_modules/.bin/node-pre-gyp'
canpoyrazoglu opened this issue · 13 comments
I'm trying to install jetifier using the steps described in readme.
I've converted my app to AndroidX via the standard AndroidX migration in Android Studio refactor menu.
I've run npm install --save-dev jetifier
, it completed successfully.
When I run npx jetify
I get the following error:
ENOENT: no such file or directory, stat 'node_modules/fsevents/node_modules/.bin/node-pre-gyp'
I've also tried uninstalling the dev dependency and installing it globally but no avail.
What am I doing wrong?
I've examined the logs and apparently NPM registry is returning 404 for Jetify for some reason:
12 http fetch GET 404 https://registry.npmjs.org/jetify 1415ms
13 silly fetchPackageMetaData error for jetify@latest 404 Not Found: jetify@latest
14 timing stage:rollbackFailedOptional Completed in 1ms
15 timing stage:runTopLevelLifecycles Completed in 1626ms
16 verbose stack Error: 404 Not Found: jetify@latest
The URL https://registry.npmjs.org/jetify
returns:
{"error":"Not found"}
After doing npm install --save-dev jetifier
, try running:
$ ./node_modules/.bin/jetify
Or add a script in your package.json
{
...
"scripts": {
"jetify": "jetify",
...
},
...
}
Then run npm run jetify
@m4tt72 It can't install jetify in the first place:
-bash: ./node_modules/.bin/jetify: No such file or directory
What node
version do you have?
@m4tt72 Node is 12.4 but I don't think it's relevant. The NPM package registry is returning 404 for the package at https://registry.npmjs.org/jetify
Try removing node_modules
and package-lock.json
and running npm install
again
Now the command executes, but prints nothing at all. Is this normal?
It should print that it is jetifying
a file. If it prints nothing means that there is nothing to jetify
!
I just double-checked the docs because this seemed like a naming confusion.
The package name is jetifier
, so npmjs.com knows it as such and should correctly 404 if you try to npm i jetify
because that's not this package. The package name is a noun
But then the action of doing it is a verb - so it's react-native jetify
And yes - as @m4tt72 said, if it has no work to do, it prints nothing. So even if it jetified something on a first run, on future runs there may be nothing to do. If there are 3 things to do in one file it will actually print 3 times for that file
I might update the docs with description of the output though - I can see how that might be worrying if you integrate a new tool and...nothing...
Or maybe it could keep count of how many files it processed while it worked, and how many need changes, and print a summary line "jetifier processed 432 files and jetified 23 android support references" (or for reverse, "reverse-jetified 23 androidx references") 🤔
I just saw this myself actually, on a mac with node v12.5.0 and v12.4.0.
Not sure when it happened but apparently something is depending on node-pre-gyp being installed, and it isn’t, because when I npm -i —save-dev node-pre-gyp
it went away for me.
worked fine in node v11.x
Alright, last update on this unless I can pin it down. Just to say I definitely saw this on one of my machines (a mac), but not the other (linux) and I couldn't pin it down even after adding osx to our CI build matrix.
My solution locally was npm i -g node-pre-gyp
although you could really add it anywhere I think (even local and as devDependency) and it should solve your problem.
Wish I had a reproducible test case but until I do at least we have a workaround.
I did
npm i node-pre-gyp --save-dev
But then I got:
NOENT: no such file or directory, stat 'node_modules/metro/node_modules/jest-haste-map/node_modules/.bin/sane'
So after that
npm i node-pre-gyp --save-dev
Same error, so... guessing...
npm i jest-haste-map --save-dev
Same error