Problem to execute gulp server at legacy app - javascript

Yo guys!
I get early a job on a legacy app, using gulpjs
After having installed all dependencies, when I try execute the application with "gulp server", get the following error at console:
D:\scripts\node_modules\gulp-sass\index.js:186
).toString();
^
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> (D:\Playkids\playkids-simple-pages\scripts\tasks\development.js:4:12)

Related

Getting started with Mongoose

When I put in the code
const mongoose = require("mongoose")
I get back the following error:
/Users/user/shares3/node_modules/mongodb/lib/utils.js:1069
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> (/Users/user/shares3/node_modules/mongodb/lib/operations/add_user.js:6:17)
This code is as simple as could be. I have tried reinstalling the mongoose package.
Do you have any ideas on how I can troubleshoot this?
The issue is caused by using a (very) old version of Node.js that doesn't support try/catch.

Unexpected token when running grunt build

I'm trying to execute the following command grunt build but when trying it the below error message appear
PS C:\Users\EDMA\Documents\Tutenlabs\Bitbucket\tuten-macarena-backoffice-web> grunt build
C:\Users\EDMA\AppData\Roaming\nvm\v6.16.0\node_modules\grunt-cli\node_modules\micromatch\index.js:44
let isMatch = picomatch(String(patterns[i]), { ...options, onResult }, true);
^^^
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> (C:\Users\EDMA\AppData\Roaming\nvm\v6.16.0\node_modules\grunt-cli\node_modules\findup-sync\index.js:12:10)
I navigate to C:\Users\EDMA\AppData\Roaming\nvm\v6.16.0\node_modules\grunt-cli\node_modules\micromatch\index.js:44 path and looked for index.js file to check whether there's an error or not, but the strange thing is there isn't. Any idea what's going on here?
Aditionally, this is AngularJS.

it gives "SyntaxError: Unexpected token" when importing express-handlebars

when I add this line error appears and if removed error disappears
const expressHandleBars = require('express-handlebars');
This is the error,
C:\Users\Hp\sample-project\node-mongodb-api\node_modules\express-handlebars\lib\express-handlebars.js:230
);
^
SyntaxError: Unexpected token )
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
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)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\Hp\sample-project\node-mongodb-api\node_modules\express-handlebars\index.js:9:25)
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)
at Module.require (module.js:497:17)
What version of Node.js are you using? Please check this issue.
The error cause by Trailing commas in function call feature. This feature had been implemented in Node v8 so you have to upgrade your Node.js to version 8+ to be able to use express-handlebars.

Making Discord Bot - Syntax Error When Trying to Start

I am relatively new to coding so I followed a simple tutorial on how to create a Discord bot, but when I try to start it by using the command node bot.js in Command Prompt, I get this error:
SyntaxError: Invalid or unexpected token
at new Script (vm.js:73:7)
at createScript (vm.js:245:10)
at Object.runInThisContext (vm.js:297:10)
at Module._compile (internal/modules/cjs/loader.js:657:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
at startup (internal/bootstrap/node.js:266:19)
Can someone please help me prevent this error from occurring?

Running "ng" causes "Unexpected token ..."

When I run ng with any command, then causes
ng -v
C:\nodejs\node_modules\#angular\cli\models\config\config.js:16
constructor(_configPath, schema, configJson, fallbacks = []) {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\nodejs\node_modules\#angular\cli\models\config.js:3:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
node -v
v6.10.0
npm -v
4.4.1
I tried reinstalling the node, npm and #angular/cli. No solution has helped.
#Edited, Solution
I deleted ng, ng.cmd from C:\nodejs\ and folders #angular/cli/, angular-cli/ fromC:\nodejs\node_modules, and reinstall #angular/cli, and then
works correctly.

Categories

Resources