Nuxt 3 after building : [Vue Router warn]: No match found for location with path "/anynonexistingroute" - nuxt3

I built a nuxt 3 project using npm run build and i`m running it with "node .output/server/index.mjs", just to test it. But when I make a request to a inexistent route, this warning is outputed to the terminal, and I think that on production it would slow down the performance. How can I fix this, or at least disable terminal logs ?

Related

Error during building swagger in laravel application with vite

Get the following error after running npm run build in laravel. If I run npm run dev everything seems to work fine. But in build this error occurs.
rendering chunks (2)...warnings when minifying css:
▲ [WARNING] Expected identifier but found "*" [css-syntax-error]
<stdin>:1:30219:
1 │ ...fter{clear:both}.swagger-ui .cf{*zoom:1}.swagger-ui .cl{clear:le...
╵
Following error is shown during loading the swagger page:
Uncaught TypeError: Cannot read properties of undefined (reading 'isRequired') swagger.67892d56.js:162
at 1543 (swagger.67892d56.js:162:9585)
at Ve (swagger.67892d56.js:191:4143)
at swagger.67892d56.js:193:40222
at swagger.67892d56.js:193:72778
I am building a laravel application and using swagger for route documentation. In production it works well but during build this error occurs.
Looks like this issue which was fixed in Swagger UI v. 4.15.3. Update your app to use the latest version of Swagger UI.

I've got an issue with using 'visit'

When my Cypress tests are run on Github (headless).
When I call visit('/page') - get a 404 error. The page definitely exists.
CypressError: 'cy.visit()' failed trying to load:
http://localhost:4200/page
I can run the same tests locally (headless and headed) and they work fine.
Anyone have any ideas why this could be?
I should add that this is an Angular Application and there are no 404's because all routes are handled with wildcard. I know this page exists and happens if i try to visit another page that exists.
Version:
"cypress": "^10.6.0",
This is the .yml file. The baseUrl is set to 'http://localhost:4200' in the 'integration.config.ts' file.
So found the answer.
We are serving the Angular application with 'http-server'. It was only recognising the route '/' and was returning a 404 for any other app routes / pages.
We fixed this by adding --proxy http://localhost:4200? to the http-server command.

Laravel Vue.js components are not working on server

I am new to Laravel Vue and I recently came to a project. at my localhost everything working fine, but when I pushed my project to the server via git, the Vue components not working. it says this error in the console...
Uncaught SyntaxError: Unexpected token '<' app.js:1
there is no npm install on the server so I run the command locally "npm run production" and pushed the app.js and all other js files via git to the server.. the server files are the same as localhost but Vue components not working on the server, but they are running on localhost..., I am stuck to the problem with 3 days, any help will be highly appreciated.
Thanks
Just for clarity, the CSS file is rendering but the JS file not
In my console:
Resource interpreted as Stylesheet but transferred with MIME type text/html: /rider/auth/public/css/app.css.
Uncaught SyntaxError: Unexpected token '<' app.js:1
So the issue was in the .env file , and there was a variable "ASSET_URL = ./public" , this was not allowing the application to go to the correct path . Thanks #Aless55 for your great support

Debugging Axios requests in React Native

I'm trying to debug axios requests in my React Native app using axios-debug-log.
I've added the library: npm install --save-dev axios-debug-log
Before a user logs in and starts using the app, I set the local storage (or in RN's case, the AsyncStorage): AsyncStorage.setItem('debug', 'axios')
In the top of the file with my axios API requests, I added require('axios-debug-log');
However, I'm not seeing any logs when I use axios. The docs for axios-debug-log don't include any specifics about using the library with RN, so I'm not sure if there's something I'm doing wrong. If there is another library/ techniques I could use to debug axios requests in my RN app I would be open to using those as well.
Using AsyncStorage will not work. You need to set NODE environment variable.
Option 1
Add the following code on top of your index.js file.
let debug = require('debug');
debug.enable('axios');
Option 2
Other way you can do it is using npm 'babel-plugin-transform-inline-environment-variables' npm package.
run
npm install babel-plugin-transform-inline-environment-variables
Now got to .babelrc file inside your react-native app directory and add following code.
// .babelrc
{
“presets”: [“react-native”],
“plugins”: [
“transform-inline-environment-variables”
]
}
Finally run your app with following command. It will set a node env variable DEBUG as axios.
DEBUG=axios react-native run-ios
DEBUG=axios react-native run-android

Laravel Asset Management, how to use installed NPM library (reference error)

I'm quite new to managing assets in any other way than a direct download, and copying the required files to a designated folder and simply referencing this. However, I wish to keep my assets "close to the framework" and therefore hope to get some clarity regarding how it is done in Laravel.
I am using Laravel v5.4 and NPM v5.3.0
I want to use the Sweet Alert library and so did
npm install sweetalert
which placed the files in the node_modules directory and package.json as expected
This is where the confusion begins. I then did
npm install --no-bin-links
(the no-bin-links flag recommended for Windows hosts by the docs)
and
npm run dev
thinking this would compile/minify the library to my app.js or vendor.js (which does not exist), or at least do some magic to let me use the library.
The output states:
DONE Compiled successfully in 8551ms
which suggests to me that I have simply failed to include the Sweet Alert library in this process.
PHPStorm does suggest the library as an auto-complete option, but the application fails to load the library, stating in the JS Console on load:
jQuery.Deferred exception: swal is not defined ReferenceError: swal is not defined
I have also tried "require"-ing the library in bootstrap.js, stating:
window.swal = require('sweetalert');
or simply
swal = require('sweetalert');
Where 'sweetalert' again is suggested by the IDE autocomplete.
Here is how I attempted to use it:
$( document ).ready(function () {
alert("Hello!"); //works
swal({
title: "Hello!",
text: "Hellooo",
type: "error",
confirmButtonText: "OK THEN"
});
});
Which throws the error mentioned above.
I also tried initializing using
window.swal({...
sweetAlert({...
which fail.
What am I missing? And how are you supposed to use NPM packages in a Laravel project/what are the best practices?
Any help is greatly appreciated.
You need to add a reference to your sweetalert vendor file in your webpack.js config file.
mix.scripts('/vendor/..../sweetalert2.min.js', '/public/js/sweetalert.min.js');
That will copy it from your vendor folder to your public folder when you run
npm run dev

Resources