-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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
RN's package.json specifies in-exact version numbers, which routinely breaks builds. #12772
Comments
Using exact versions in package.json doesn't solve this thoroughly because of transitive dependencies. Use yarn.lock on the app developer's side if you want to defend against this. |
Thanks for catching this @MattFoley. I agree that using I was able to fix this on someone's project by running |
Definitely switching to yarn, but that wouldn't fix this issue for new projects. i.e.: If I had started a new project, which didn't yet have a yarn.lock file, it would pull in the wrong versions of RNs dependencies, and this new yarn.lock file would be still be incorrect.
…Sent from my iPhone
On Mar 7, 2017, at 1:10 PM, James Ide ***@***.***> wrote:
Using exact versions in package.json doesn't solve this thoroughly because of transitive dependencies. Use yarn.lock on the app developer's side if you want to defend against this.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Thanks Brent, that's exactly what I ended up doing to fix this issue this morning. It just took me a few hours to track this down as the problem.
…Sent from my iPhone
On Mar 7, 2017, at 1:16 PM, Brent Vatne ***@***.***> wrote:
Thanks for catching this @MattFoley. I agree that using yarn.lock would help you avoid this problem on your app, although what happens for new projects? The template for init doesn't include yarn.lock and so all new projects will break. For people still using npm there isn't much they can do either (I guess theres shrinkwrap, but..)
I was able to fix this on someone's project by running yarn add ***@***.*** -save
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
To be fair, Ide is right, this isn't just a problem with React Native, but more a problem with the JS npm ecosystem as a whole. Having RN specify exact dependencies would at least help a little bit. :)
…Sent from my iPhone
On Mar 7, 2017, at 1:16 PM, Brent Vatne ***@***.***> wrote:
Thanks for catching this @MattFoley. I agree that using yarn.lock would help you avoid this problem on your app, although what happens for new projects? The template for init doesn't include yarn.lock and so all new projects will break. For people still using npm there isn't much they can do either (I guess theres shrinkwrap, but..)
I was able to fix this on someone's project by running yarn add ***@***.*** -save
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Just re-bundled and can confirm the change in the uglify repo fixed the issue. I was experiencing this issue on RN 0.36.1 today. |
Nice effort put in by @brentvatne to help with the debugging to get a patch out. Going to close this issue since we think it's been resolved upstream. If you're running into this problem, clear your node_modules (or |
I gather this is why I'm getting edit: Yes it was unrelated, the js file was silently failing to minify due to an incorrect and unused js import. If anyone with the same issue spots this I'd recommend manually bundling JS order to debug these sorts of issues with |
That's the same problem. You'll want to verify that 2.8.5 was installed (check the output). I actually changed my package.json manually to 2.8.5.
…Sent from my iPhone
On Mar 8, 2017, at 3:02 AM, Kyle Johnson ***@***.***> wrote:
I gather this is why I'm getting Unhandled JS Exception: Can't find variable: runInContext running a release build. However yarn add ***@***.*** -save didn't seem to work for me. Is this issue unrelated?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
Uglify 2.8.9 (published a few hours ago) the latest works. It was only 2.8.8 that broke RN. Shouldn't need to lock in at 2.8.5 as was previously suggested. |
Ah right, I think in my case it was an unfortunate combination of the two issues in that case - I'd already got 2.8.5 before diagnosing my import issue. Glad this is sorted anyway! |
Resolved in mishoo/UglifyJS#1573 |
Oh man, the last two days have suucked because of this. Eat your vegetables and shrinkwrap your dependencies kids. |
Thank you for figuring this out! @MattFoley |
Well, that was an hour of my life I won't get back. Glad I found this issue. This is impacting newer versions as well. I'm on RN 0.41.2 and |
@brentvatne / @ide I believe I'm running into this same problem again just now, and I'm digging into what the specific issue is. I'm looking at an old version of my code base that hasn't changed in months, and when rebuilding now, a ListView in that version no longer works properly, and I'm seeing a slew of dependency differences from the npm install. These are all coming from automated build jobs, so user error is doubtful. Will re-ping this thread if I solve it, currently looking at uglifyjs again, which was on v2.7.5 last this was built, and is now on v2.8.12. |
That looks like that was the problem again. @brentvatne Thank you for adding that to the package.json! (v2.7.5 was exactly the right version to be on it looks like!) |
Summary: As per uglify-js maintainer kzc's comment in mishoo/UglifyJS#1573 (comment) we should be locking our version to prevent issues like #12772 from happening again. No test plan needed, people are already using this version of uglify-js (it's the latest). Closes #12802 Differential Revision: D4749853 Pulled By: javache fbshipit-source-id: 866a19cb2c1add31b55e14d0f4dadb7f68fda64c
Description
The package.json for this project specifies almost all dependencies with a
^
. This routinely breaks older builds.React Native 0.32.1 was previously using uglify-js 2.8.5. This morning/last night uglify-js published v2.8.8. Since RN specifies
"uglify-js": "^2.6.2"
in it's package.json, npm began pulling in the latest v2.8.8.This new version of uglify-js now conflicts with lodash 4.1.x usage alongside react-native. Our build which worked just fine yesterday was broken by this change. runInContext was no longer defined correctly on a release/minified build from the react-native packager. See npm page here for release history of uglify-js.
Comparison of symbol definition change causing this breakage:
This change meant that our JS file threw an exception on load, and was completely broken. This has to be the dozenth time this has happened to since switching to React Native, and has wasted countless hours.
Solution
Stop using in-exact versions. Specify exactly the version of dependency you need. (Why on earth would you want dependency version changes happening underneath you?)
Additional Information
The text was updated successfully, but these errors were encountered: