Cannot resolve module 'json' - json

I'm dealing with a very weird issue. For some reason, since a few days, my application doesn't seem to be loading JSON files anymore inside modules.
The app was created with create-react-app, and has been in development for a while without any issues. I've had a dependency in the project (world-countries) that basically only exports a json file. This dependency is not a recent addition.
So, here's the thing. From one day to another, I get the following error while starting/building the app:
Module not found: Error: Cannot resolve module 'json' in /Users/…
As far as I know, I made no changes that would result in this, and create-react-app's webpack version is still the same.
Requiring a random JSON file in the root of my app goes well, somehow this odd behaviour only seems to apply to json files within node_modules in the app.
Some other points:
By this point, I have reinstalled dependencies and node.js multiple times, checked file permissions, etc. To no avail.
Another dependency that also used a json file internally also had this issue, but I managed to circumvent that.
I've explicitly installed json-loader in case something with webpack got messed up, but this didn't make any difference. In fact, I find it curious that _the missing dependency is "json" and not json-loader.
I have a feeling that this is a weird issue caused by some file limit, as when I run the dev server, I get errors relating to too many open files. My project isn't that big, so this seems weird, and I have a feeling it might have something to do with some npm linked modules I have, but there is no recursion or anything.
I'm still quite perplexed, and have no idea what the issue might be. Any suggestions on how to fix this are very welcome

Some people seemed to have had a related issue regarding importing json files in the past. It wasn't in a dependency but I believe it is related.
I took the time to scaffold a new project, import the world-countries modules and log it, and it was working fine.
I would recommend you to update re-scaffold or update all your dependencies, but most notably react-scripts which is version 0.9.5 for me. My create-react-app-version is also 1.3.0.

Related

How to make docstrings from cythonized module available to Pylance?

I am working on a fully cython compiled python package, using setuptools and some reStructured Text docstrings to generate the pdf documentation using sphinx-autodoc with good success.
The docstrings are not displayed when loading the package in Jupyter Notebooks (using Pylance language server in VSCode). I did not test but suspect that the issue exists in other IDEs or frontends either. Switching to e.g. Jedi as a language server in VSCode did not help.
Using the help(...) command on the routines/classes yields the expected docstring, so the issue does not seem to be with the cython compilation.
There are quite a few issues about formatting issues popping up when searching for Docstrings and Pylance, the issue never seems to be that they simply can not be retrieved.
Since sphinx (autodoc) does not throw any errors and generates a full-package encompassing documentation set fine, this seems a lot like a problem with the language servers to me.
However, I suspect that there may be any compiler directive or setuptools option that I am unaware of that could help - but I do not know about these.
I do have
compiler_directives={'embedsignature': True}
in the setup.py and since the docstrings do show up when using help(..), I do not think this is an issue.
I have also added
import Cython.Compiler.Options
Cython.Compiler.Options.docstrings = True
even though that is indicated as being the default, and it did not change the behavior at all.
Scavenging through the options of Pylance in VSCode was unfruitful, too - I did not expect much there anyways, since obviously the display of the docstrings does work for plenty (all?) other packages that I looked at. Everything is on defaults.

Changing one CLJC-file causes full recompile

In a fairly large project I am working on, I have a separate source folder with .CLJC-files that are shared between the frontend (Clojurescript) and backend (Clojure).
I noticed that making a trivial change in a CLJC file (e.g., adding a blankline) causes all or most of the CLJC + Clojurescript files to be rebuilt (as listed by the compiler with :verbose to true). This causes a delay of about 45 seconds on my machine. Strange thing is that this even happens when the CLJC does not contain any functions, and is not require'd by any other CLJS/CLJC file...
Does anybody know what could cause this behaviour? My project file is quite standard, and I use the latest versions (CLJS 1.9.293, lein-cljsbuild 1.1.5 or even 1.1.6-SNAPSHOT).
Unfortunately it is not possible to even temporarily remove those pecularities from the project just to test this issue.
To answer my own question:
This problem was not caused by the specifics of my project -- it happens with every project, because it may be the case that a CLJ or CLJC file contains macros that (when changed) cause CLJS files to be implicitly modified. lein-cljsbuild therefore recompiles all CLJS files.
For some background discussion, see https://github.com/emezeske/lein-cljsbuild/issues/345
I have filed a bug report at https://github.com/emezeske/lein-cljsbuild/issues/457

Remove MVVMCross from UnitTest (Ressource.Attribute Error)

I have a Unit-Test Project where i used MVVMCross for Dependency Injection, but since i made a Implementation of the Library which i tested for UWP, i kinda wanted to use the Unit-Test for both Implementations.
For that purpose i used Compiler Switches and ended up removing MVVMCross.
But when i uninstall it from the packages i always get "Resource.Attribute" does not contain a definition for "MvxBind" and some other MVVMCross attributes.
I rebuilded the project. I deleted the obj and bin folder and looked through every file in the project folder, but i cant find a thing why it keeps adding those attributes to my Ressource.Designer.cs
If i add MVVMCross back and just dont use it all, obviously it works. But i kinda want to remove it there, since it is just overkill.

Signal command map injection error

I am using Robotlegs to create a simple application in as3, which I have been using for a couple of months now. I seem to be getting an injection error when injecting the ISignalCommandMap into my config file, which has only started happening after I moved my application from one computer to another. It may be to do with conflicting libraries, but I have re-downloaded the newest versions of everything. I am also using starling in the application, but everything was working on the other computer.
Here is the error I am getting
Injector is missing a mapping to handle injection into property "commandMap" of object "[object Config]" with type "Config::Config". Target dependency: "robotlegs.bender.extensions.signalCommandMap.api::ISignalCommandMap|"
Any thoughts to why this has started happening?
What solved this for me was extending MVCSBundle like in this example project and then using that class in place of MVCSBundle.

Flex 3 Referencing old files, will not compile updates to code

I am making some changes to a Flex 3 project and have run into trouble. I am using Flex Builder 3, working on a PC. Everything was working as expected throughout my first day of code updates, but on day 2 Flex started behaving badly.
The problem started when I removed a component, and then got an error that it couldn't find the specified component in some accompanying AS3 code. No problem, I updated the reference so it wouldn't look for the old missing component (a form item). When I compiled the project in debugger to check my work, it failed when it got to that part, and gave an error that it couldn't find the component I'd removed. However, my code had fixed the problem, and the error was referencing a line of code that wasn't there any more. I proceeded to change the file around greatly, and even resorted to creating a new file, changing the name of it, and then recompiling it. I did a clean compile as well, rebooted my machine, restarted Flex, but every time it gives an error referencing the bit of code that isn't even there any more. It's as if it's loading a cached project each time (both in debugger and run mode).
For reference, here's the error I'm getting:
ReferenceError: Error #1069: Property Winter Cost not found on views.PopupUsage and there is no default value.
Well, the file "PopupUsage.mxml" doesn't even exist any more and is not referenced in my project at all, but it's still being referenced by Flex when I compile the files. Any ideas? What can I do to make Flex move on and look at my code?
Thanks in advance!
The only time I have encountered this issue is when I've been developing an application that uses another SWC in the project build path. Where I've come undone is not referencing the SWC project in the project properties build path, but only referencing the SWC itself. If you have the SWC project code imported and you're editing it, then you can see this type of behaviour, appearing as though there's a mysterious cached version of your app, where in fact its simply the build path that isn't quite right.
So check your project properties build path for this issue, it sounds obvious, but I've lost count of the amount of times I've quickly imported the code for a library and forgotten to reference it properly in the application I'm using it in!