I just created a new project and have run it for the first time using F5 or Ctrl + F5. The result in Chrome is:
The site can't be reached
err_connection_refused
I checked the option at the breakpoints for "Exceptions caught" and the following error is displayed.
Without "Exceptions caught" checked, the next error raised:
I tried to run "ng s -o" from the terminal and all work fine. The site is working well on port 4200, but I like to debug.
Here is my launch.json file, all by default:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}"
}
]
}
Why is this happening?
I also had this issue and none of the solutions listed were helpful.
However, the problem was rather easy to solve.
Just go into the Network tab of the Chrome Developer Console. Be sure that the connection is on No throttling and not Offline.
This misleading error message seemingly has nothing to do with Chrome or any deprecated functionality. It can have many root causes and seems to occur whenever connectivity can't be established.
I got this while following the React tutorial for Visual Studio Code. In that tutorial you start by creating a template with npx and then running it with npm start. That worked, and I could see that it was using http://localhost:3000 for the URL in the browser.
However, when I changed the code as the tutorial requested and set a breakpoint to debug, I got the error in the OP's post, both with Chrome and with Edge.
Visual Studio Code was creating a default launch.json file for debugging and populating it like this:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
"version": "0.2.0",
"configurations": [
{
"type": "pwa-chrome",
"request": "launch",
"name": "Launch Chrome against localhost",
"url": "http://localhost:8080",
"webRoot": "${workspaceFolder}"
}
]
}
And I needed to manually change the 8080 to 3000 which fixed the problem.
The key for me was configuring the breakpoint to catch the exception like the OP described (note - you can only configure that with the Debug icon selected in the far left icon menu). While the emitted error message is still the misleading "deprecated" one, there was a message that "the site can't be reached" which you can find if you dig a little - as shown here:
I imagine that practically any configuration issue that causes the connection to fail will cause this error. So firewall issues, missing host program, bad configuration (like mine), etc.
I had the same issue and the problem was with the URL. It was https://localhost:8000; in place of http://localhost:8000.
So try checking your URL and routes.
My server was just not running locally. :) Starting localhost solved it.
For me, the issue was a React/Next.js application was not running.
Basically, you have to keep the application running in a separate window/terminal to be able to attach the debugger. This is unlike the other application where it starts from debug console itself.
In my case, it got resolved by closing the browser and recompiling the app.
Instead of launching your application using the option "Launch Chrome against localhost", rather set your application name for launching - Resolved.
See the attached image for more context.
I had this same error and I resolved it by turning off my plugins. Specifically a CORS plugin I have been using.
Try this:
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"request": "launch",
"name": "Launch Chrome against localhost",
"type": "dart"
}
]
}
I've tried many of the solutions suggested, and found someplace else this tip that was helpful:
I was unable to reach http://localhost:3000 from npm start run in a react app. So I tried: http://127.0.0.1:3000 and to my surprise it worked!
After some googling, I tried a suggestion to erase my browser cache, so I did it. All cached images and files (Google Chrome) and boom! It worked once again.
I have seen a lot of solutions for this problem, but nothing worked.
After a little debugging and commenting out many parts of the code, I managed to locate the issue.
Basically, it occurs on the backend; not the frontend.
There was an infinite loop that kept responses stuck. Fixing that issue, solved it for me.
I think we should just remove the cookies in that URL:
I displayed a similar message in my debug console and the problem was that the local web server was turned off and therefore unreachable.
I turned on the server in the virtual machine and the app started working again :-)
In my case, I had a Blazor solution and began receiving the "Crbug/1173575, non-JS module files deprecated message". Besides this, I also received a 404 error for the Index.html file!
The cause was that I inadvertently removed the reference in the .Server project to the .Client project. The project compiled fine without the reference, but I guess ASP.NET Core does some sort of reflection-based analysis on the dependencies to dynamically build the route map.
Restoring the reference to the .Client project on the .Server project fixed the problem.
In my case, the problem was because port 4200 was taken by another application (Docker). As soon as I changed the port to 4201 by adding the next structure in the serve section of angular.json file the problem was solved.
"options": {
"port": 4201
}
This may be of use to someone working on a project that communicates across iframes, I found this warning within a current web application: Crbug/1173575, non-JS module files deprecated.
In my case, the reason was that the resource iframe origin wasn't being served meaning the Iframe request URL was not accessible. When serving the resource the warning disappeared.
I had the error crbug/1173575, non-JS module files deprecated with some PDF files displayed in an iframe.
It was because they had a comma (",") in the filename. After renaming the file, everything was OK.
My problem was in the network settings of my Windows 10 computer, not on the browser. I have tried my URL in another computer and mobile browsers, and it was working fine.
So, I have fixed the issue by resetting my network settings
To do that, go to Settings → Network and Internet → Scroll down to Network reset.
Wait for 5 minute until it restarts.
I faced this issue while debugging in Visual Studio Code for an Angular application.
The probable causes may be the server is not up and listening to port. You may start the server manually by ng serve --port with port number. Also compare the URL in launch.json and compare the port number.
In my case it was caused by uBlock Origin. Disabling it on the website promptly fixed the error.
I was adding links to Amazon Affiliate while all of a sudden I faced this error.
To solve it, just stop your adblocker.
To add another angle to this. I named my JavaScript modules with .mjs. After setting my web server to serve mjs with MIME type application/javascript. I got the error
'crbug/1173575, non-JS module files deprecated.'
None of the answers here helped. To fix it I gave a path to the module.
From
<script type="module" src="xxx.mjs"></script>
To
<script type="module" src="./xxx.mjs"></script>
And the error went away.
I ran into this error on three separate Next.js projects. It was the same error in Chrome, Chrome Incognito, Firefox, and Edge.
It happened on a production build (next build && next start) and development server (next dev). After trying a number of fixes – ensuring I was on HTTP, not HTTPS, checking if the port was in use, deleting folder node_modules and running npm install, etc. – the thing that finally worked was restarting my computer...
For aiohttp.
I've stumbled upon this issue with an aiohttp server.
By default it was running on 0.0.0.0:8000 The solution was to change the host and the port to localhost:8080 in main.py file:
web.run_app(app, host='localhost', port=8080)
I had a similar issue. However, I discovered a different solution. It's still worth checking the steps in the GitHub link from the OP’s solution.
The project I was working on was made in an older version, and the launch.json URL had // delimiters. Replacing these with no delimiters resolved the issue.
from
"url":"file:///C://exampleParent//exampleChild//file.txt"
to
"url":"file:///c:/exampleParent/exampleChild/file.txt"
When I try and follow the steps described on Chrome Debugging with Angular CLI, I get a message that the library is no longer supported and a link to this article:
Request’s Past, Present and Future #3142
I had encountered the same problem in Visual Studio Code when I tried to debug a Python file. I resolved it by deleting the previous launch.json file and create a new one for this file.
I had a similar encounter in a JavaScript project. But I hadn’t learned JSON, but I just deleted the last three commands in
the JSON file that is removed the names "url" and "webroot".
I had the same issue with an app that needed to run navigator.geolocation.getCurrentPosition in my React application which of course needs HTTPS.
// .env.local HTTPS is set to true
HTTPS=true
The problem - I was loading the page with HTTP and not HTTPS.
Error Screenshot
Checking point (if you are working with a folder/file)
Check the folder/file name
Remove special characters (the folder/file name does not allow special characters)
Debug you code carefully (Java catch exception can't catch those errors)
Related
While using npm run dev on a NextJS(v13) project, I am unable to see the latest changes I made in the code on browser. This is the first time I have faced such a issue and that also at 2 different times:
Redirects in next.config.js
async redirects() {
return [
{
source: '/',
destination: '/dashboard',
permanent: true
}
]
},
The destination was /overview prior to this and when I changed it to /dashboard I was still getting redirected to /overview. I got frustrated and left it there but when I started it the next day, the redirect was working fine!!
Usage of window on browser-side routes
Using window was giving an 'window undefined' error so I removed it from the project but that error still popped up. I tried a global search and there was no other mention of window object, which led me to this conclusion.
Possible issues:
I think the nextJS dev or build might be getting cached somewhere, I just dont know where.
I am using NextJS v13 and am using app/ directory which is yet experimental so that might be causing issues. (less likely)
Here is my directory structure(there are no server-side components):
What did I try?
Deleted .next folder thinking the build/dev code might be cached there (didnt work)
Restarted VSCode
Restarted PC
Could you guys give any suggestions on what might be causing this issue?
So i just installed VScode on my Windows 10. I keep getting the following error:
"Can't find Node.js binary "node": path does not exist. Make sure Node.js is installed and in your PATH, or set the "runtimeExecutable" in your launch.json"
I've tried reinstalling VS and rebooting, tried installing from different folders (both on C drive and the second time i added it to my programs folder)
I tried installing a node.js extension which fails every time and then prompts me to try it manually...which then leads to a file downloading automatically, but when i add it to my VS folder through my file explorer, nothing happens still.
I tried installed a different node.js debugger
I tried changing my debugger to chrome too but all it does is take me to localhost:8080 and an empty page of course.
When i go through file explorer and look through the path of my .vscode folder, the nightly extension (node.js) is there....
I'm new to VScode and have just been using Scrimba's terminal to do my code but decided to try something more professional
I think you're putting node.js in the same folder/path as .vscode, this isn't correct. What you need to do is set node.js in your PATH which is different. See this answer for more information on how to set PATH/environment variables. Also install it from the official website nodejs.org. After changing your PATH remember to reboot.
I wouldn't recommend downloading "node.js extensions" as those likely are not legitimate, and as you've said yourself they don't work. Only download from the official website.
You have to install nodes from this website https://nodejs.org/
I'm getting this error on browsers console, and js file are not loaded:
VM305:5551 crbug/1173575, non-JS module files deprecated.
But if I use a private windows, there is no error and the webpage works.
I deleted the launch.json file, it worked for me
I had this problem twice in React.js. Both while using libraries for pdf to image preview. One was Mozilla's PDF.js library. The npm package is known as 'pdfjs-dist'. When I removed this package, the error was gone and the server ran perfectly normal.
These libraries might be using old cr.js or module technologies.
Personnaly, I suddenly encountered this problem today while I never encountered it before. Deleting the launch.json didn't fixed the problem. I opened that file and saw that the url tag was followed by "http://localhost:8080" instead of my HTML file's path. So I replaced "http://localhost:8080" with the path of my HTML file, then it was working again.
if you don't want to delete anything then just type in the terminal of your project :
npm i
to reinstall/ recheck dependencies.
I am trying to build a Tensorflow.js app, it works all good locally, but when I hosted it (I tried Netlify and Vercel on both Firefox and Chrome) I got this error:
Uncaught Error: Based on the provided shape, [1024,3], the tensor should have 3072 values but has 30. Any ideas? My only one was that it would have to do something with CORS but I don't know.
Hosted:
Localhost:
JavaScript code: here
you will get such error messages if the bin file is corrupt.
This can happen, for example, if you downloaded a repo from GitHub as a ZIP file, which uses Git LFS instead. To avoid that you need to clone it or download the bin file separately.
In your case I assume that your website hoster does not allow the file extension .bin and you might get an error message as content of the file back.
Also the download times of the json and bin are a bit surprising.
Both are almost identical, although the bin file should be much bigger and therefore requires a longer download.
Best regards,
Sascha
I too faced this issue while running face-api.js models integrated on a React app with a NodeJS server. It was working fine on the local dev environment , but on building and running it, it was not able to resolve the model's promises, with the same error. On exploring the issue, earlier I was using "serve" (npm i -g serve) to host my build app, and it was getting this error. But on changing hosting server to Nginx web server, I application was successfully hosted with this issue resolved.
Switch to Nginx server to host, it will work.
Thank you so much for the reply. I was downloading the model files from the github repository and had the same error.
Way Around [Solution]:
Opened up the demo web application provided in the same github repo and then from the developer tools from the network tab, downloaded the model shared files and model.json file and then ran the local demo again and it worked.
Thanks for the help.
I got the similar error with making use of tensorflow.js in a react application even though neither have I downloaded the bin file from github nor extracted it from a zip file. I was able to serve the model.json and binary file locally perfectly fine but when I deploy it, I was first getting a runtime error and then a on the second try a similar error with different numbers.
It pulled out a sheet metal until I come here and see that maybe I need to check the checksum of the binary files. Well yes, this was the issue. They were different. Git wasn't able to see it. Even though I remove the binary and created a .gitattributes configuration to avoid git making changes to the bin file, It didn't solve the problem. As a temporary solution I upload the binary file manually to our repo for now and it works. I will update this answer as soon as I get to meet with our devOps engineer and have a better understanding for this issue.
I was getting a similar error using IIS Express however I could run the exact same files in VS Code using Live Server with no issues.
After a few days I found this is because the extensionless shard files not having a MIME mapping for them and may be downloaded wrongly. I ended up serving these files from a public folder in local IIS and adding a MIME mapping for "." (extensionless files) to "application/octet-stream" (MIME for binary files).
Later I found this comment on Github that says you can just add the ".bin" extension but you have to change both paths in the corresponding manifest.json
I think either solution should work. The former worked on my Blazor Server project
I am using live server extension for Visual Studio Code IDE, and found it gives me this error:
GET http://127.0.0.1:5500/model.weights.bin 404 (Not Found)
Uncaught (in promise) Error: Based on the provided shape, [3,3,3,8], the tensor should have 216 values but has 39
So I created a new folder named model, and moved the two files, model.json and model.weights.bin, into it. And changed the file path to the new location:
classifier.load("./model/model.json", customModelReady);
Then the error is gone.
I am trying to run a react-native app on android emulator, but I am getting an error like
Error calling Appregistry.runApplication
AVD: 'Nexus_5X_API_23(AVD) - 6.0
OS:Windows 10
Please help on this?
I had almost the same problem you currently have a few days ago. For me it was a real device.
From all my research, the solution that worked for me is the following :
When you launch your app by typing react-native run-android, the error appears.
So, reach your directory containing "adb.exe" ( for me it was C:\Users\username\AppData\Local\Android\Sdk\platform-tools\ )
open a terminal from here. And type adb reverse tcp:8081 tcp:8081
Then, by reloading the app on the phone, it should work.
I hope this will help you !! ( if not, shame on me )
Cheers ;)
EDIT :
I've find a more convenient solution to solve this problem.
When you launch your "react-native run-android" you might have a comment saying "adb is not recognized as internal or external command..."
Well, instead of manually using the adb command, you can add an environment variable leading to the adb.exe.
Just get to the "Control Panel" > "System and Security" > "System" > "Advanced System Settings".
From here, click on "Environment Variables". Search for the "Path" variable in the "System Variables" section. Click on it and press the "Edit" button.
There you can add a new path to this variable. Just click the "New" button and write the adb.exe path. For exemple C:\Users\username\AppData\Local\Android\Sdk\platform-tools\
(For the oldest versions of Windows, you'll have to add ";C:\Users\username\AppData\Local\Android\Sdk\platform-tools\" to the content.)
This is it, now the adb reverse tcp:8081 tcp:8081 command will be ran automatically upon building.
Hope this will even more helps you !
I had the same issue, my fix was to run
$ react-native start
in the background then run
$ react-native run-android
According to me this error comes when:
1) You did not run the packager at the right place i.e, you hit the wrong folder to run react-native packager so just navigate to your project's directory and run react-native start.
2) when you code something wrong with respect to Appregistry module.
3) Shutdown everything Xcode, packager, simulator etc and restart it again.
4) From the error one thing strikes in my mind is the name of the module
AppRegistry.registerComponent('AppName', () => componentName)
matches with the #"AppName" on your AppDelegate.m on the call for
[[RCTRootView alloc] initWithBundleUrl:...
moduleName:#"AppName"
launchOptions:...
5) As we are using react's component so we need to give the first character of our class name with caps on.
6) Let's see what's wrong in index.android.js and index.ios.js
Cheers :)
Finally, I got it working.I created a new AVD
Nexus6 API 23
.Earlier I was trying with Nexus5x API 23.Thanks all
I had same problem. It occurs that McAffee was on port 8081 and block packager.
My solution:
react-native start --port your_port
In android emulator, Command + M show dev menu, click on "Dev Settings" and then click on "Debug server host and port" and set it to your_ip:your_port.
Then
react-native run-android
In my case (after, of course, going through everything I could find here and elsewhere), I realized I had turned my WiFi off on my phone...doesn't work like that! Hope it helps someone
I had the same issue and was able to resolve it by setting my local computer as the debug server in the android emulator. Open the android emulator, Command + M to bring up a menu, then click on "Dev Settings" and then click on "Debug server host and port" and set it to 127.0.0.1:8081. Then from within you project directory run react-native run-android. I hope this helps.
Make sure that port 8081 is available. In my case One of my services is running on Port 8081(tomcat webserver).
I was having the exact same issue (because this is a very generic message) but the problem was different. In my case it was a newly created project, the emulator wasn't working but a real device did work.
My problem was the limit of watchers inotify can handle on Linux by default, which is a Linux kernel subsystem that acts to extend filesystems to notice changes to the filesystem, and report those changes back to applications and it's widely used, including android studio and react native; by the time I was trying to execute react-native run-android all of the watchers were allocated on my system, causing the process to fail on this same message.
To change the max amount of watchers inotify can handle, you need to edit the file sysctl.conf, which will be usually located at /etc/sysctl.conf or /etc/sysctl.d/custom_name.conf and add the following line:
fs.inotify.max_user_watches = 5242881
After writing the file you need to execute sysctl -p filename.conf where 'filename.conf' is the path and name wherever you saved the .conf file for sysctl. Once changes are applied everything should work as expected.
I too had the same problem. I solved the problem to run on real device.
As told by Mr Jedi, McAffee blocked the port 8081. So I have modified Project-Folder>\node_modules\react-native\local-cli\runAndroid\runAndroid.js file's function from
function tryRunAdbReverse(device) {
try {
const adbPath = getAdbPath();
const adbArgs = ['reverse', 'tcp:8081', 'tcp:8081'];
to
function tryRunAdbReverse(device) {
try {
const adbPath = getAdbPath();
const adbArgs = ['reverse', 'tcp:8081', 'tcp:3040'];
and started the application on
react-native start --port 3040
For me I just needed to add the platform tools to my Path environment variable so that react-native can start the adb server.
I was getting:
'adb' is not recognized as an internal tool or program
To fix this I added the following to my Path environment variable.
C:\Users\<Username>\AppData\Local\Adnroid\sdk\platform-tools
Then running react-native run-android worked!
I know this question has been given so many answers but, I think it's worth it adding my solution, hope this helps someone out there.
In my case the problem was from my virtual machine, although I didn't investigate but by creating a new virtual device the app ran smoothly with no problem.
So just create a new virtual device. :)
I searched for a solution for my registry error for a week and tried all these solutions, and all that was missing was I needed to add in my app.json file under expo:
"platforms": [
"ios",
"android",
"web"
],
So, if all else fails, try to add this into your expo.