I was trying to upgrade my RN from 0.19 to 0.27 using the commands from the doc,
i.e.
npm install --save react-native#0.27
react-native upgrade (I chose the overwrite option when asked to update the latest RN files)
The npm install step worked fine but the upgrade step wiped out all my code in android plugin folders and any changes made to MainActivity.java. My environment is : MacOS, Genymotion, Android development
Thanks!
You've missed that react-native upgrade asked you if you want to overwrite your files. react-native upgrade replaces your files with newer version if it's different than the default one. It does not merge your changes. Also jump from 0.19 to 0.27 is a big one so probably there was a lot of changes.
Yes, react-native upgrade will wipe everything out. There's a command line option now (react-native link) that will put most of it back in, but not everything.
If you choose not to overwrite the files you are risking not including something very important and it may break the upgrade.
I don't know of a good way around this. My process is to use a good ide that shows me exactly what has changed between upgrades. Then I go though each change and see if I'm missing something. The java code and android studio files tend to be quite easy. But the xCode stuff is not, the pbxproj file is particularly awkward. You mostly need to reconstruct it by using Xcode. So... every time you do something to the xCode project, make a note of it! Yes this is a terrible solution, but I don't know what else to do.
I've ended up making detailed notes about everything I do during an upgrade. And I upgrade recently because its easy to forget.
Related
I have an angular application I haven't touched in a while. I haven't made any changes since the last time it was working. Now I need to modify a few things. But the application won't serve locally so I can't make the changes. I don't understand what's wrong.
The npm install worked just fine and I don't have any code errors preventing it from running. I get the following error message when trying ng serve, but it seem extremely unhelpful. Any ideas?
Unfortunately without an exact reproduction of your project this will be really hard to pin point, but looking at what is given in the screen shot and prior experience with similar issues, I think this could be an issue with your package.json. Newer versions of node and npm look for the carets symbol (^) in both your package.json and the installed modules' package.json. When found, it will install newer versions of the package without error. Then when you go to run the project, the typings will break and Angular will refuse to compile and you get errors like these.
I would recommend removing all carets in older Angular projects to prevent this from happening as it is common occurence even when upgrading from more modern versions (I had this happen to me when upgrading from Angular 13 to Angular 14). However, with Angular 1.7/AngularJS not being supported anymore, I would recommend that you look into upgrading or rewriting the project in a modern version of Angular or another modern framework that fits the projects needs.
I'm trying to figure out how to interact with the Sonos One using JavaScript; Sonos has developer guides and downloads for JavaScript but none of them work, because the node-ssdp project has been archived and is no longer available. Does anyone have a reference or a contact at Sonos through which we can access the devices directly? The cloud API works but is a lot heavier than talking to the devices directly over a LAN.
Okay, this ended up being a dumb question. Sonos apparently forked node-ssdp and hosted their own for a while, and the standard npm node-ssdp library works fine for this purpose.
Remove the node-ssdp dependency from the package.json, then:
npm i node-ssdp
Not everything works, because the Sonos samples in JS were written for very old versions of Node and have not been updated, but the base packages are fine.
I'm trying to create a Windows JavaScript app. Every time I do, i get this error:
The project file 'C:\Users\Matt\AppData\Local\Temp\qugu4hsq.ibc\Temp\Test.jsproj' cannot be opened.
The project type is not supported by this installation
I've looked up a solution, and it involves editing the jsproj file, but in source/repos/test, only the .vs, Test, and Test.sln files/folders exist.
I've looked in the temporary folder, and qugu4hsq.ibc doesn't exist. Is it because the Windows Universal C# apps require I upgrade to windows 10 to use?
See this:
https://developercommunity.visualstudio.com/content/problem/159626/jsproj-cannot-be-opened-project-type-not-supported.html
Specifically:
It's working for me now. To fix, I had to uninstall the "Universal Windows Platform development" workload. And then reinstall it. Then in the individual components, I had to manually make sure that all the Windows 10 SDKs were checked.
Good luck
I'm aware of the benefits that Yarn brings about and what it does that npm doesn't. I do have some doubts however:
Does Yarn use npm under the hood for some of the other commands that retain the same behaviour as npm?
If no, is there a reason why they were re-implemented in yarn and are there downsides to this approach?
No, it is a rewrite.
Rather than continue building infrastructure around the npm client, we
decided to try looking at the problem more holistically. What if
instead we attempted to build a new client that addressed the core
issues we were experiencing? Sebastian McKenzie in our London office
started hacking on this idea and we quickly became excited about its
potential.
-- https://code.facebook.com/posts/1840075619545360
It offers the same API (without some shortcuts if you notice). This is (I am guessing) because the original interface was simple enough and to ensure adoption.
It is much faster, solves typical problems of npm (undeterministic deploys mainly). This can be only achieved with a top-down rewrite, they also changed how deps are installed (fetch, calculate, download, link) so the logic is different.
The downsides of this approach is that it requires a huge amount of work. Normally you would just PR over the main repo, but given they wanted a whole different thing and Facebook has the means, they decided going solo.
Another big downside is that its benefits won't be immediately available for all the npm older users, since it is not an upgrade and it does not come installed with node.
I had a look at Yarn's source code and found that there was custom code written for each command: https://github.com/yarnpkg/yarn/tree/master/src/cli/commands.
I guess the downside to this approach is that in future when npm adds new commands, the Yarn team would have to track the changes and manually implement them.
I've entered the brave new world of MVC core and using NPM to get various JavaScript packages. However, I've hit a problem which I'm not entirely sure what the best option to solve is. Just to set the scene, I've got a gulpfile which is copying JS from various NPM packages in my project (such as jQuery and bootstrap etc...) to the 'wwwroot/lib' folder.
I now want to add a typeahead 'autocomplete' search box to a particular view, so I added typeahead to the package.json file and updated my gulpfile to copy the additional *.js files to 'wwwroot/lib'. All fine so far, the problem is when I debug my project and open that particular page I get an error where the typeahead.js file has some code at the beginning:-
require('xtend')
I wasn't aware of this command in JavaScript, but a quick search on the internet reveals this is part of JS when run on 'node' or node.js?
I have not used 'node' before (yes, ignoring the fact I'm using NPM to get packages - I only ended up doing that due to a Visual Studio bug in how Bower works) so the question is how do I now get (this particular) typeahead to run within a browser? So I figure options are:-
1) just manually download typeahead instead - but is that not defeating the point of having all these package managers in the first place?
2) start using Bower again (don't think the 'version' bug has been fixed yet)
3) use something to 'fake' the node 'require' commands so that it will work in browser
4) something else...
I've seen a few things that may solve this problem on the internet, but I didn't want to spend ages sorting out a fix which may be the complete wrong way of doing it. Has anyone any suggestions for the best route to follow?
Scratch that, I found another typeahead package on NPM called 'typeahead.js' instead of 'typeahead' and this is just standard JS no NODE stuff. Works perfectly in browser