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

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).

Related

Sveltekit adapter-static fails: Cannot read property 'kit' of undefined

I'm trying to build a Sveltekit site using the adapter-static.
npm run preview works fine and npm run build seems to build fine before giving me a cryptic error:
Cannot read property 'kit' of undefined.
Can you point me towards a way to debug this - I cannot find where exactly the issue is.
Svelte is still under active development. Most likely you're trying to use the latest documentation while having the older Svelte dependencies installed locally.
Upgrading your Svelte dependencies should solve the problem.
Try to create a new project with a fresh install of SvelteKit and adapter-static and then copy your code from the old project. That worked for me. Seems like the two were out of sync.

webpack, webpack-obfuscator and webpack-cli version hell

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...

React Native: NPM Module being uninstall each time a new is installed

I am using a package named react-native-linear-gradient which can be found here. I had to go through quite a lengthy process to eventually get the link to my project (by manually linking via the Binary link with libraries in XCode. I got it working fine, however, each time I install a new package via NPM, linear-gradient is removed from my node-modules folder.
1.Can anyone shed some light on why this is happening? (Happy to provide additional information)
2.Will this impact deployment of the application if this is not solved?
SOLVED: Downgraded to 5.7.1... It seems 5.8.0 seems to cause the same error Michael mentioned.

Angular & Webpack Dependency Versioning

Recently I've been running into an issue and I'm not sure how to best resolve it. We have a very modular architecture on the front end. We write individual angular components, put them in different repo's, and then include them in other apps as they are required, built with webpack & included via NPM.
Recently I've run into issues where multiple versions of a module end up in the compiled /dist folder coming from different places such as:
Directly included in the App I'm working on
2x Indirectly included through a module that I included (see chart for details).
The reason different versions could be used is that at the time CodeA is written ModuleA may be at version 1, then at a later date CodeB is written which also uses ModuleA which is now at version 2.
Then CodeA and CodeB are included in CodeC and now you have a module name collision on ModuleA.
With this setup, I believe if the multiple modules by the same name are loaded, the last one to get loaded is going to be the code behind that module name. Meaning it will be the one to be used by all modules. So there's no guarantee that the most up-to-date version is will be used. This usually results in getting an error that a method on ModuleA by name XXX does not exist.
To make sure I'm running the latest version of the module I have to go in and manually update (npm install) and build with webpack (npm run build) each library and then push them all to Github. Then I have to npm install in my root app. This isn't always an easy thing to do as the individual libraries' code may need updated to use the latest version of the module in question.
I'm looking for a solution to this issue. I'm guessing a structural/organizational change that will help us to not get into this predicament. If you have any solutions/advice/articles I need to check out please share. Thanks!

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