webpack, webpack-obfuscator and webpack-cli version hell - reactjs

This must be one of the most tiresome conundrums a web developer can delve into.
I can ask a straigthtforward question right here however:
Which versions of the three mentioned.
(webpack, webpack-obfuscator and (possibly )webpack-cli)
ensure that it all works together?
if you know, you can stop reading here,
and (please) give an answer, or you can read on:
I have a Yii2 php app, with npm/javascript/React frontend support. I do:
composer install,
npm install,
npm run build.
When this is done from scratch (fresh clone from Github, caches cleared), it almost always ends up with npm run build giving this:
Error: The number of constructor arguments in the
derived class t must be >= than the number of
constructor arguments of its base class."
NOTE: I am completely happy just to have this issue fixed, so it all builds. Not sure of the webpack-cli part coming up (if you read on).
And NOTE again: This problem occurs in Windows 10, when I try to build a local version. All works well in Linux (Ubuntu 18.04).
We now have in package.json:
"webpack": "^2.4.1",
"webpack-obfuscator": "^0.17.3"
I then try higher versions of webpack-obfuscator until this error ceases, but instead there is another error (!):
TypeError: Cannot read property 'emit' of undefined
So, then I figure: maybe we can test higher versions of webpack as well?
I do that, but then comes another error:
Error: Cannot find module 'webpack-cli'...
(So again, I am not sure it's something I need, I belive I answered yes to some yes/no question coming up)
There are zillions of versions, and I am now sick & tired of it. This problem has haunted me the last years.
Now this day I decided to go to the bottom with it once and for all. I have spent 6 hours, and I failed.
So very thankful for an answer, somebody must have experience from this...

Related

React-navigation installation error(following official docs). Unable to resolve module #react-navigation/native-stack

There are a bunch of questions already covering this exact error, but I've been through all of them, and so far none of the answers have worked for me. Platform is MacOS
Here is the error:
Steps to reproduce
(Following official React Navigation docs https://reactnavigation.org/docs/getting-started/):
Create a new expo managed app
expo init my-app
Navigate to directory
Start the app
expo start
**** At this point everything starts and works correctly ****
Install reactnavigation(follow official docs https://reactnavigation.org/docs/getting-started/ )
yarn add #react-navigation/native
Install dependencies
expo install react-native-screens react-native-safe-area-context
Wrap the code with a Navigation container (per the docs)
Start the app
expo start
**** App no longer works. Fails with the error I posted earlier ****
Things I've tried that haven't worked
The instructions that the error message provides (though I skip step 1, as I don't have watchman watches installed). Main thing here that I would expect to work is the deletion of node_modules and yarn.lock, but no luck :(. Same with deleting cache
using yarn add to add the dependencies instead of expo install
using npm to install everything
updating expo-sdk (I'm already on latest)
reinstalling everything
So, I actually was able to answer my own question in the process of writing it. I often do this, as I make sure to spend several hours trying to debug in the process of writing the question and making sure I've covered everything I can think to try.
Not sure of official self answer etiquette, but this was a pretty frustrating error for me, so I figure I'll post what worked for me here in case it can help anyone else in the future.
Answer:
The issue for me had nothing to do with the code or app itself, but rather the IOS simulator. Force quitting the simulator and restarting resolved the error. It seems that simply ctrl^c -> expo start -> i -> r is not enough to clear the internal state of the simulator.
There was actually even a clue in the error message itself, but I missed it because the error looked so similar to the one I was expecting. The clue was in the name of the module it was unable to resolve "#react-navigation/native-stack". In my reproduction steps, I was only using the NavigationContainer, as I was trying to get that working before installing any of the Navigators and trying to use those.
Why was it trying to resolve the native-stack navigator? I'm not 100% sure, but my guess is that there was some kind of cache in the simulator that wasn't being cleared properly. Why do I think that?
This problem started with me trying to use a native-stack navigator in another app I'm working on. I quickly ran into this error, and figured the best way to debug would be to spin up a brand new blank app and try to get ReactNavigation working in there. I started with just navigation package and NavigationContainer itself, and once I couldn't even get that working, I assumed the problem was with the base react-navigation package installation. I failed to notice that it was still trying to resolve that native-stack navigator.

AngularJS throws Error: [ng:cpws] Can't copy! Making copies

I installed a project from work on my personal computer and only on my machine I get this runtime error. I personally think it has to do with the way the code is compiled.
My question is why the error appears on my machine only?
Error: [ng:cpws] Can't copy! Making copies of Window or Scope instances is not supported.
https://errors.angularjs.org/1.6.7/ng/cpws
First thing I checked to see if the node and npm versions are the same and they are:
node: v8.11.3
npm: 5.6.0
OS: Windows 10
The piece of code that generates this error is using $scope.$watch(object, callback, true). After looking on the angular documentation I deleted the third parameter which seemed to be the trouble maker. After that, I encountered other problems so I asked myself why on my machine (which from an environment perspective is the same) the error appears and I stopped modifying the code and start looking on the building part.
I don't know if this will help you but the page that generates the error contains a form build using angular-formly.
Also, we are using laravel mix to compile the code.
UPDATE
I just updated the node and npm version. At first, I had some issues with the node-sass package but I solved it.
I still have the errors. :(
node: v11.10.0
npm: 6.8.0
Try to recheck if the correct version of angularjs is loaded for you. Many boilerplates declare the angular dependency using something like:
...
"angular": "^1.6.7",
...
When npm sees this it will load the latest MINOR version if the library is not in node_modules directory. If it is in the node_modules directory and it is greater or equal to 1.6 it will leave it as is. Having a package-lock file might save you from this issue if you actually commit it in the version control system that you use.
This is problematic because loading the 1.7 version might bring in backward incompatible changes (angularjs does not respect semver).

ReactJS, create-react-app gets an error

I run from my console the "create-react-app practise1" command but it gets an error.
I couldn't understand why. Can you help me?
Normally I used it before as "create-react-app react-complete-guide" and this command had worked at that time.
I share all the codes that i get as screenshot.
Thank you,
My Console screenshot
You should probably have text like this in your error:
error Received malformed response from registry for "timed-out". The
registry may be down.
Currently part of NPM is down. https://status.npmjs.org/
Identified - Several packages including "require-from-string" are currently unavailable. We are aware of the issue and are working to restore the affected user and packages. Please do not attempt to republish packages, as this will hinder our progress in restoring them.
Jan 6, 19:45 UTC
This isn't a problem directly with create-react-app itself but one of it's dependencies it needs, require-from-string. And that issue is coming from the npm registry itself, and temporarily, not create-react-app. See this about the npm registry status and this issue from create-react-app itself:
What you can do, is if you have another project bootstrapped with create-react-app, you can copy it and make changes as neccessary for starting a new project. Or - you can wait until this issue from the npm registry is resolved. This is what happens when modern projects take a large number of dependencies - if a few of those dependencies aren't available, the whole project can have problems.

Should Bower be Updating a Package Every Time Repeatedly?

Not much to the question really - I have an error when trying to build with gulp (first highlight). I noticed when I run "bower update bootswatch," it downloads something every time. I have very little experience with package management, so I was wondering if this is a problem, and if it is, what I can do about it.
Edit: An important note is that it doesn't reinstall/re-download any of the other tens of packages.
Edit 2: On the end of the big rectangle there is a covered-up part: "invalid-meta bootswatch is missing "main" entry in bower.json" - is this important?
Just based on the history of bower questions on here, I am guessing no one has any clue as to what's going on, understandably - neither do I. With that said, I am posting a lazy "solution": After verifying versions and such are exactly the same with a co-worker, but the file content is different, my coworker sent me his bootswatch folder and I copied it into bower components. That fixed it.

Need help building libpandoc, Haskell + C and .NET bindings for Pandoc

I'd love to use Pandoc in a utility I'm writing (C# console app) and I found this bindings project on GitHub, libpandoc and by extension, it's .NET bindings project, libpandoc-dotnet.
I wish the author had included the built DLL but I suppose he wanted to leave it open to future Pandoc versions.
I have no Haskell experience whatsoever, I just want the .NET bindings in the end. I'm trying to install the dependencies via cabal but I don't understand the error messages and a cursory search leads me to believe installing base is a no-no, so I'm not sure what to do.
C:\Development\Contrib\libpandoc>cabal install base-4.1.0.0
Resolving dependencies...
cabal: Could not resolve dependencies:
next goal: base (user goal)
rejecting: base-3.0.3.2, 3.0.3.1, 4.6.0.1, 4.6.0.0, 4.5.1.0/installed-7c8...,
4.5.1.0, 4.5.0.0, 4.4.1.0, 4.4.0.0, 4.3.1.0, 4.3.0.0, 4.2.0.2, 4.2.0.1,
4.2.0.0 (global constraint requires ==4.1.0.0)
rejecting: base-4.1.0.0 (only already installed instances can be used)
rejecting: base-4.0.0.0 (global constraint requires ==4.1.0.0)
If a kind soul could even build the damn thing (fork it? upload it somewhere?) I'd love you forever. Alternatively, show me how to build it properly and I can handle it from there I think. Though now that I think about it, not sure I have a C compiler installed.
Update:
OK. So it all comes down to the fact that libpandoc is 3 years old and its dependencies are out of date. I had no luck trying to get all the old Haskell tools to install and work, I probably had no idea what I was doing. I got as far as installing some dependencies but some dependencies weren't versioned so I had to track each version specifically and I eventually gave up.
I then just updated the dependency versions for libpandoc itself and now I've got all the dependencies built and linked.
The only remaining issue is that libpandoc needs to be updated to work against the latest Pandoc release (1.10).

Resources