Meteor: file upload error - javascript

I've been trying to use the meteor-uploads package (https://github.com/tomitrescak/meteor-uploads) to create a file upload system for my test webapp, the code for which can be found here:
http://meteorpad.com/pad/ckgN6GL4msQn4Ms5h/Jobs
I have made sure to install the necessary packages:
meteor add tomi:upload-server
meteor add tomi:upload-jquery
I couldn't find these on meteorpad so the link above probably won't work.
When I try this on my local machine, I get an error that says UploadServer is not defined, which then leads to file uploads giving a 503 error
I changed the code slightly from the example provided in the tutorial. When I use their code directly everything seems to work OK.
What/where is the error in my code that is causing the problem?

It turns out that this is because process.env.PWD returns undefined on Windows systems. This then leads to the uploader trying to upload to a directory without permissions. I've fixed this, for now, by manually specifying the upload directory path

Related

Cannot GET /xxx.html when I try to load a HTML file using window.location.href in Vite

I'm developing a project where I need a authentication system, I'm using firebase to for that.
I don't want the login form to appear if the user is already logged.
So I did it:
This code
It works just fine, but when I use: npm run build and npm run preview, the index.html file works properly, but when I try to go to the main.html page, I get a Cannot GET /main.html error.
I could use React and React-route to do that, but I can't, it is a work for college and I have to use plain JavaScript.
I'm allowed to use firebase and vite.
If I can't make it work I will give up of vite for now and use firebase only. What do you guys think?
Vite Folder structure
Error

VM305:5551 crbug/1173575, non-JS module files deprecated

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.

Uncaught Error: Based on the provided shape, [1024,3], the tensor should have 3072 values but has 30

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.

Parse deploy of cloud code failing with message "Update failed with internal error"

I've been running Parse cloud code for a few months using CLI version 1.4.1 with no problems. I just updated using the CLI to the latest version, 1.4.2, but now when I deploy I get this output:
Uploading source files
Finished uploading files
Update failed with internal error
I've checked for the one problem I see documented elsewhere, which is erroneous quotes around some parse classes like Parse.User and Parse.Installation. It doesn't look like these are my problem.
Is there any way to find out more about the error, besides trial and error with my several thousand lines of code? :)
Upon upload attempt, Parse is parsing your code (pun intended :-) checking for errors, and deployment fails if any errors found.
One possibility is to check Logs (in your Dashboard under Core/Logs), also the Error submenu of Logs.
Another is to run the command parse develop your_app and see all the errors in your terminal.
For a large code, you probably want to write some unit tests if you aren't doing this already.

Problems with using ncp inside my grunt plugin

for some reasons, I´m doing a custom grunt plugin for copy some specific directories. The idea for the plugin is to pass a parameter from console with the source path.
I´m using ncp module to copy directories but inside my grunt plugin doesn´t work (If I use node to execute the code, all works fine... the directories are created... the files and directories and files are copied).
It doesn´t do anything... no ok console message... no error console message... I´ve being debugging inside the ncp code and I´ve discovered that the function fs.lstat it doesn´t work.
I´ve reviewed that the source path and the destination path are ok... so... I don´t know... maybe is a nonsense but I can´t find it ;)
You can see both examples via Gist:
Using Node: when the task is completed, show me the "done!" message.
Using Grunt: it doesn´t do anything... only create the destination directory.
Thanks.
I´ve found a solution that its works for my intentions. I´d have liked to use grunt copy task inside of my plugin but I couldn´t config the correct values manually.

Categories

Resources