FB CTF - SyntaxError: Grunt is not generating JS Files - javascript

Installing prod: https://github.com/facebookarchive/fbctf/wiki/Installation-Guide,-Production
This is the error message that I am getting when I try to install by any given method(direct,docker and vagrant):
[+] Running grunt to generate JS files
/var/www/fbctf/node_modules/grunt-legacy-log-utils/node_modules/chalk/source/index.js:106
...styles,
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:549:28)
at Object.Module._extensions..js (module.js:586:10)
at Module.load (module.js:494:32)
at tryModuleLoad (module.js:453:12)
at Function.Module._load (module.js:445:3)
at Module.require (module.js:504:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/var/www/fbctf/node_modules/grunt-legacy-log-utils/index.js:12:13)

try it
-> # apt remove nodejs
-> # curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
-> # sudo apt-get install -y nodejs
Probably, if it is not version 12, an error appears

On Windows install the latest version of node.js and the error should disappear.

Was working on getting FBCTF up, tried to search everywhere but no one has a fix. Found a fix myself.
nano package.json
In package.json, change from
"grunt": "^1.0.1",
to
"grunt": "1.0.1",
The "^" seems to update the version of grunt to 1.3.0 (As of writing this) which apparently is not compatible with the FBCTF which have not been maintained for 2 years.

Related

Unexpected Token '.' on raspberry pi even though script runs fine on windows

I am encountering an error when I go to start one of my Discord bots on my Raspberry Pi 3B.
/home/pi/Downloads/xx/xx/bot.js:301
if (channel?.messages.cache.has(packet.d.message_id)) return;
^
SyntaxError: Unexpected token '.'
at wrapSafe (internal/modules/cjs/loader.js:915:16)
at Module._compile (internal/modules/cjs/loader.js:963:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
at Module.load (internal/modules/cjs/loader.js:863:32)
at Function.Module._load (internal/modules/cjs/loader.js:708:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
at internal/main/run_main_module.js:17:47
When running the same bot on my main Windows 11 Machine, it runs perfectly fine.
NodeJS/NPM on both my main machine and my R-Pi are running v16.15.1. Is there any way I could fix this? Thank you in advance.
As mentioned on the nodejs.org website, you can install the latest versions with the NodeSource deb package:
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
# and then
sudo apt-get install -y nodejs
The default packages on your system are not up-to-date.
Good day

I have a better_sqlite3.node error when i require quick.db

i dont have errors when i install but when i require quick.db in my main.js (its a discord.js bot in v12)
const db = require('quick.db')
i have an better_sqlite3.node error in my terminal
-C:\Users\Fatsah\Desktop\Wizzy Bot\node_modules\bindings\bindings.js:121
throw e;
^
Error: The module '\\?\C:\Users\Fatsah\Desktop\Wizzy Bot\node_modules\better-sqlite3\build\Release\better_sqlite3.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 93. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1183:18)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:94:18)
at bindings (C:\Users\Fatsah\Desktop\Wizzy Bot\node_modules\bindings\bindings.js:112:48)
at Object.<anonymous> (C:\Users\Fatsah\Desktop\Wizzy Bot\node_modules\better-sqlite3\lib\database.js:9:24)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
code: 'ERR_DLOPEN_FAILED'
}
PS C:\Users\Fatsah\Desktop\Wizzy Bot>
i tried to reinstall and update node.js into the last test
Node version : v16.7.0
Discord.js : v12.5.3
Npm Version : 7.20.3
I have this error not long ago, when I was using node v14 and I have the same with canvas / canvacord but is canvas.node
Reinstall all your dependencies, you probably upgraded Node after you installed better-sqlite3 and you need to rebuild the library again.

DÄ°scord.js on Linux

I was using Windows and now I switched to Linux. When using Windows, I was running my discord.js bot with the "node bot.js" command. I can't run this command on Linux. I created the bot ID again with the command "npm init" and made the test command "node bot.js" but again I get the error. I need your help. (Linux Mint 64 bit)
Error output: /home/blour/Desktop/ew/node_modules/discord.js/src/client/Client.js:41
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/blour/Desktop/ew/node_modules/discord.js/src/index.js:8:11)
I assume from your error that you are trying to use a try/catch statement, you need to provide the catch part of the statement with an error parameter:
try {
// Do something
} catch (error) {
// Do something with 'error'
}
You have an incomplete try/catch statement. Go to that file and to that line, find a console.error in those brackets or something like that and add (error) (replace error with the object in console.error) just after catch and before {.
You have an old version of nodejs installed. To reinstall it to a newer one, use:
sudo apt-get purge --auto-remove nodejs
sudo apt-get update
sudo apt-get install build-essential libssl-dev
curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
source ~/.profile
nvm install 14.17.4

webpack-dev-server missing dependency 'hpack.js'

Starting a new project, I've installed the latest versions of webpack and webpack-dev-server. I've added the webpack-dev-server command to my start script in my package.json. Oddly, the dev server was working the first time I ran the project, but I then blew away my node_modules folder and reinstalled. Since reinstalling I am continually blocked by the following missing dependency error.
npm start
> webpack-dev-server
module.js:442
throw err;
^
Error: Cannot find module 'hpack.js'
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/a6001382/analytics/analytics-q/node_modules/spdy-transport/lib/spdy-transport/protocol/http2/hpack-pool.js:5:13)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
spdy-transport seems to be the culprit, but I am still getting the error even after explicitly running "npm install" on spdy-transports root, and ensuring that "hpack.js" exists.
Has anyone else experienced this missing dependency?
Resolved by running npm i -g npm#latest-4. Some versions of NPM don't correctly set the "main" field of package.json if the package contains a period.

Getting an error when installing Gulp js

I'm trying to install Gulp js on my computer.
I think it is installed but not completely because when I run gulp -v in powershell it returns these lines:
[12:43:04] CLI version 1.3.0
[12:43:04] Local version 3.9.1
But when I want to run .\node-setup.cmd it throws the following error:
Error: Cannot find module 'gulp-autoprefixer'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\LOBOS\FDD.WAP\gulpfile.js:5:20)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
Press any key to continue . . .
Any ideas how to solve this?
most likely you have gulp-autoprefixer as a dependency in the package.json file of your project but you did not install it locally.
try to run npm install from the command line and see if it fix your issue.
The problem wouldn't be solved if I would install gulp-autoprefixer because afterwards it would require another module and after that another module and so on...
The solution was to deprecate the package.json file by changing the react-bootstrap-table from my version (2.8.2) to version 4.0.0-beta.2. By doing so, the json file will have a version which is not depending on react-toastr.

Categories

Resources