"You should not use <Link> outside a <Router>", but Link is inside BrowserRouter - react-router-dom

As the title describes, I am getting the error for reasons I don't understand. I am using create-react-library, which may be somehow affected things. I copied all the code from my example project (in which there are links inside of a BrowserRouter) into a new folder, and while the issue doesn't come up in the original directory, the copied code throws the error. Any ideas?
ReactDOM.render(
<BrowserRouter basename={process.env.PUBLIC_URL}>
<App /> // All the Links and Switches are in here
</BrowserRouter>
, document.getElementById('root'))

It looks like the files were getting corrupted, most likely because I was copying through Atom's UI.

Related

Error: Cannot find module "src/auth/guards/jwt-auth.guard.ts" despite nothing even looking for it

I'm seeing the mentioned error, with stack trace below
Error: Cannot find module 'src/auth/guards/jwt-auth.guard'
Require stack:
~/Documents/Code/nestjs-passport-learning/dist/src/user/user.service.js
~/Documents/Code/nestjs-passport-learning/dist/src/user/user.module.js
~/Documents/Code/nestjs-passport-learning/dist/src/app.module.js
~/Documents/Code/nestjs-passport-learning/dist/src/main.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:939:15)
This error makes no sense, though, as the user module/service is not looking for that auth file at all. It was at one time, but I removed it while trying to debug the error. It seems like something internal to node itself is bugged and still looking at an outdated version of the code.
What happened:
Code was working/running perfectly
I decided to add "UseGuards(JwtAuthGuard)" to one of my user.service methods
At the same time I decided to setup debugging, so I added a launch.json file
Tried running the code. It built, but had a ton of "can't find bla bla" errors at runtime.
I stopped the app and figured the error was do to me not exporting the class in auth.module and not importing the AuthModule in UserModule(which was true).
I fixed that error, and restarted
Now getting the error message above
I removed the "UseGuards(JwtAuthGuard)" and all imports to it and AuthModule import in UserModule, as well as the launch.json file(ie revert back to exactly the code that was running perfectly 10 minutes earlier)
Still getting the same error(despite there being nothing in the user module that looks for it.
Why is user.service.ts still looking for that jwt-auth.guard.ts file?
Other things I've tried:
removing the "jwt-auth-guard.ts" file itself
checking out an earlier version of the code where "jwt-auth-guard.ts" hadn't even been written yet
restarting my machine
Nothing worked, no matter what, I get that same error, despite the code not being any different the code that worked.
link to github repo
Any help would be greatly appreciated, as I have no idea what's going on, and no idea what to google to even try to fix this problem.
Alright, so after some fiddling in my application, I tried renaming my 'dist' folder to try it, and it worked! So I guess the "caching" was due to the dist folder.
Peace and happy coding!

Angular Build - Uncaught TypeError: Cannot read property 'id' of undefined

I have managed to build my angular app out as a dev build. I haven't done it as a production build yet as it gives me a few errors and i just need to test the dev build.
The dev build process goes fine, no errors or anything. I then use the files from the dist folder in a nginx docker container to host the files.
The problem is nothing is displayed but a white page and in the console i get an error saying 'Uncaught TypeError: Cannot read property 'id' of undefined'. The full message below doesn't seem to point to anything i have written and i've spent several hours searching online but can't find anything on this problem.
I've tried a few different things such as running 'npx ivy-ngcc' which i read manually compiles some stuff. Is there anyway i can get more details on the error to see if it's something i have done?
UPDATE
So i have restored the line that i commented out in main.ts as mentioned in the comments below. I have also tried 'ng build --aot' as suggested which presents me with a series of errors that all seem to relate to devextreme components that are used. I find this strange as i started the project with the devextreme angular starter project from github.
i get messages such as:
'dx-scroll-view is not a valid HTML element'
'node_modules/devextreme-angular/ui/drawer.d.ts - error: appears in
the NgModule.imports of SideNavOuterToolbarModule, but could not be resolved to an NgModule class'
If you go in the devtools and click on Sources, "Don't pause on exceptions" and check "Pause on caught expecptions" and continue until you get the "id error" you will find what module the error is thrown. In my case was a third party library called 'ngx-card/ngx-card' and it's module was the cause of the error (CardModule). Hope this will help find at least the cause of the error
I managed to solve the problem by disabling ivy in the angular compilation options. As soon as i did that it worked building both dev and production versions and is now working perfectly within Nginx.
Thanks to everyone who offered help :)
In tsconfig.json of your Angular project, put this to disable Ivy, the new Angular template engine
{
...
"angularCompilerOptions": {
"enableIvy": false
}
}
Typically, if it's not something that you've written, it tends to be an issue w/ your implementation - i.e. "Visiting a food vendor and ordering a food item they don't provide".
I know it's not a specific answer, but ensuring that you have appropriately configured things in your app.module would be a good first step. Perhaps attempting to build w/ AOT will also give you some more verbose failures that stem from attempting to build out.
Hopefully this helps another poor soul.
To anyone using devextreme, make sure you update your version to at least 19.2.5
https://github.com/DevExpress/devextreme-angular/issues/975#issuecomment-580172291
Starting with version 19.2.5 we support the IVY compiler.
I had the same issue and fixed it by changing from
loadChildren: './app/page/account/account.module#AccountModule'
to
loadChildren: () =>
import('./app/page/account/account.module').then(
(m) => m.AccountModule
)
in app-router.module.ts
The root cause of your error is very likely to be a module that you needed to load explicitly but didn't, or a circular reference in your own modules. Rodrigo has a good answer but to be more specific, you need to find the registerNgModuleType function in Angular's core.js and set a conditional breakpoint on the first line. The condition should be !ngModuleType || !ngModuleType.ɵmod. (You can set a conditional breakpoint in most modern browsers by right-clicking the line number.)
Once you've paused execution just before the exception happens, you can look at the value of ngModuleType if it's not undefined, or walk up a frame or two in the scope and see what the value of imports was.
For me, this issue occurred while using Storybook.
The reason it happened was because of the way I was precompiling the node modules. I was doing:
Incorrect
ngcc --properties es2015 browser module main --first-only
Correct
ngcc
Using this approach fixed it

Adding Bigdata.jar or Sinbad.jar to sublime.

I need to add bigjar to sublime so that I could use import big.data.*;
Which could be found here: https://github.com/berry-cs/big-data-cse
This link directs me to download sinbad, which I did. I now have this jar file and I don't know what to do with it.
I tried opening it. I tried going to package control but I think those are pre-downloadedable packages. I tried checking the package folder, where I am then presented with a user folder which embeds a package.Control.cache folder and other package bundles file, and dragging the sinbad.jar file in there.
I am terribly confused and just want to start my homework. If you could help or just push me in the rigth direction. I due apologize if this might be copy of another question.
AuctionSystem.java:5: error: package big.data does not exist
import big.data.*;
^
1 error

Static source file(.html) update does not working to application

I am just a newbee to jhipster. finally I generated jhipster and runned an application. I tried to change static file(.html) for test.
What I did as follows.
I changed src/main/webapp/app/layouts/footer/footer.component.html file content.
('This is your footer' --> 'This is your footer !!!!!')
Executed command yarn start. Application running without problem.
I found running application footer still' This is your footer'. But footer.component.html file content still 'This is your footer !!!!!'.
I tried many times but application's footer still unchanged.
I tried compile executing command yo jhipster.
Terminal Ask overwriting footer.component.html file? so I typed 'y'
After compile I checked footer.component.html file content. but it rolled back to the original file ('This is your footer'. not 'This is your footer !!!!!')
Please Teach me what I had missed. How can I change contents of static files.
This problem makes me crazy for last 2days.
Thanks in advance.
Please let us know if you installed any language while creating the project.
If yes then jhipster uses this following library for translations, so the actual String comes from a json file.
https://angular-translate.github.io/
You can do the following.
Instead of
<div class="footer" ng-cloak>
<p data-translate="footer">This is your footer</p>
</div>
Try the following.
<div class="footer" ng-cloak>
<p>This is your footer!!!</p>
</div>
Or a better option would be to change the json file.
src/main/webapp/i18n/en/global.json
"footer": "This is your footer"
to
"footer": "This is your footer!!!"

"Duplicate node detected" in a CruiseControl.NET configuration file

When I launch CruiseControl.NET with a particular configuration file I receive the following error:
ThoughtWorks.CruiseControl.Core.Config.ConfigurationException: Duplicate node detected
What does this mean, and what causes it?
I think you have 2 nodes in your config where it only expected one. Is there any chance you could post the config file it is throwing the exception on here as additional information? I'm using cruisecontrol (not the .net version) currently and find it can be very picky about it's XML files (rightly so) but not tell you anything about where in the file the exceptions were thrown from.
I found that I had an incorrectly structured config file. In particular, some blocks were outside of the configuration section. The error pointed to the second of these exec sections- apparently it didn't like that there was more than one of a given section inside the project.
Thus, the error occurred due a config file like this:
<project>
<tasks>
...
</tasks>
<exec>...</exec>
<exec>...</exec>
<project>
In my case I had something like:
<task>...</task>
<sourceControls>...</sourceControls>
<task>...</task>
<publishers>...</publishers>
It didn't like the two "<task>" nodes so I fixed it by removing the first "<task>" node. I was trying to do some stuff before getting the latest from svn, and then doing the build after that in the second "<task>" node. I'll need to revisit how to do that...any suggestions?

Resources