Discord.js, Problem with reconlx button pages - discord.js

I was trying to make an help page for my bot, which has pages, that are switched with Discord Buttons, to do it I used reconlx package, but after I run the bot, the console says:
/home/runner/Nightcorer-4/node_modules/reconlx/node_modules/discord.js/src/rest/RESTManager.js:32
const token = this.client.token ?? this.client.accessToken;
^
SyntaxError: Unexpected token '?'
What should I do to fix this?

You have to update Node.js to v16.0.0 .
If You aren't sure about the Node version installed, run this command on terminal:
node -v
You can download the new Node.js version here.

Related

Building React app for production throwing error in the react router dom v6.4 library

The app is build using Vite, and it's a React ts based app. The project runs normally in development mode, but when trying to build the app for production using npm run build, getting below error.
I really don't want to degrade the react-router-dom version below 6.4
[commonjs--resolver] Unexpected token (656:59) in /Users/sanketsaha/Work/School/TulipApp/node_modules/react-router-dom/dist/index.js file: /Users/sanketsaha/Work/School/TulipApp/node_modules/react-router-dom/dist/index.js:656:59 654:
655: if (typeof document === "undefined") { 656: throw new Error("You are calling submit during the server render. " + "Try calling submit within a `useEffect` or callback instead.");
^ 657: } error during build: SyntaxError: Unexpected token (656:59) in /Users/sanketsaha/Work/School/TulipApp/node_modules/react-router-dom/dist/index.js
at pp$4.raise (file:///Users/sanketsaha/Work/School/TulipApp/node_modules/rollup/dist/es/shared/rollup.js:20114:13)
at pp$9.unexpected (file:///Users/sanketsaha/Work/School/TulipApp/node_modules/rollup/dist/es/shared/rollup.js:17415:8)
Can someone please guide me here. Unable to resolve the error.
I am able to resolve the error. It was encountered due to the server configuration in vite.config.ts. It is going to get served as static pages from dist folder.

Default react project - ERROR BY SETTING HOMEPAGE- Uncaught SyntaxError: Unexpected token '<', i've read many answers none work

I'm only trying make a production build from the default react project and just by setting the homepage field in the package.json, when i run "serve -s build" on my local machine i get that error. I was getting this error in my main project, that it will run on a personal machine with nginx using reverse proxy, thats why i'm trying to make it work on the default project, to see where i can fix this. The Project runs with this field with the "npm start". I've tried most of the solutions presented in those links below and none of them work for me:
Create-React-App build - "Uncaught SyntaxError: Unexpected token <"
React/Node Uncaught SyntaxError: Unexpected token <
https://github.com/facebook/create-react-app/issues/527
Heroku create-react-app deploy Uncaught SyntaxError: Unexpected token <
https://community.netlify.com/t/react-application-builds-deploys-into-a-blank-page/2571
-Remove homepage is not a option
-Homepage field it is not incorrect since its only : "homepage" : "test" for testing in the same machine
-One of the answers suggest to edit all the source code, but i think this is not a option
-Tried to put this in the index.html "" and ""
-Most of the requests gets the status code of 304
-Putting this to the homepage field does not work too "./test"
-Sometimes i do get this error too : "Manifest: Line: 1, column: 1, Syntax error."
-Tried to clear cache and cookies
Anything else that i can try?
Many thanks to anyone that can help me on this!

'npm run build' gives me uncaught syntax error: Unexpected token '<' when I try to render the html file for my single page react app

Here is what the package structure looks. Server folder contains the flask code, the src folder contains react code.
I have a Flask server with a react app. When I run the npm build script, it builds the 'build' folder. When flask attempts to render the html for my react app, I get the error for the Unexpected token '<' for 2.ed52de7f.chunk.js. It seems rather simple, but I have been stuck on this for a while and I desperately need help. The app renders fine when I open it using 'npm run start'.
Unexpected token '<' for 2.ed52de7f.chunk.js
This means the request to get the static js file returns a HTML instead of javascript. You can do following things:
Check the url of chunk.js again, make sure it point to correct server
Trying to request that js with its url you will figure out the error
Hope this help

React app shows a blank page after the deployment

I deployed my website that uses React and Django. It works fine, but only with Django part. When I try to go to any react path, it simply shows the blank page(which is from build folder).
In the console I see three errors
Uncaught SyntaxError: Unexpected token <
Uncaught SyntaxError: Unexpected token <
Manifest: Line: 1, column: 1, Unexpected token.
Why is that? I have no idea what to do.
My deployed website: https://oridal.herokuapp.com/
If you need more code, feel free to ask for one
Ok, I was not able to understand the cause of my problem.
But I decided to do it another way, so I just took already existing application that works on React and Django, then I cloned it and started to copy and paste my own files to this new application.
Here is the link to the GitHub repository of this application.
I hope, it'll help.

Getting Angular Twitter API app working

I have been trying to get the following angular twitter API app to work out of the box but am running into an error on startup.
I am running node v0.10.36, npm 1.4.28
I just wanted to throw it out to the wider community to see if anyone could help me out.
I am trying to get the app working and am running into the error below. I tried a couple of things eg changing port, changing package.json to reflect a newer version of npm but I just don't seem to be able to get it to work. Any assistance would be appreciated. Thanks in advance.
It looks like all the node modules installed correctly.
/Users/billyjlennon/sample-angular-node/routes/tweets.js:36
var i = 0, len = tweets.length;
^
TypeError: Cannot read property 'length' of undefined
at /Users/billyjlennon/sample-angular-node/routes/tweets.js:36:28
at responseHandler (/Users/billyjlennon/sample-angular-node/node_modules/twit/lib/oarequest.js:362:14)
at passBackControl (/Users/billyjlennon/sample-angular-node/node_modules/twit/node_modules/oauth/lib/oauth.js:374:13)
at IncomingMessage.<anonymous> (/Users/billyjlennon/sample-angular-node/node_modules/twit/node_modules/oauth/lib/oauth.js:386:9)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:442:13)
It would be such a handy app if I could get it to work!!!
Have you done this per the readme:
Create a config.js file using config.sample.js as a template. Fill in your Twitter App API Keys. You will need to create a Twitter application.
The fact that length is undefined indicates you aren't getting any data back.

Resources