Unexpected token issue in truffle on Windows - truffle

I am trying to install truffle on node version 8.9.0 and npm version 5.5.1. It got installed but am not able to do anything in that. every time I try any command, even try to unbox it shows an error.
C:\Users\com\AppData\Roaming\nvm\v8.9.0\node_modules\truffle\build\86.bundled.js:55160
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:599:28)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at Object.__webpack_require__.f.require (C:\Users\com\AppData\Roaming\nvm\v8.9.0\node_modules\truffle\build\cli.bundled.js:603:28)

the required node version is Node v12 or later. https://trufflesuite.com/docs/truffle/getting-started/installation/#requirements

Related

getting unexpected token in mac terminal after installing node

Everytime i open terminal in mac, i get the below error,
/usr/local/lib/node_modules/npm/lib/cli.js:2
module.exports = async (process) => {
^
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> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:2:1)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `npm config delete prefix` or `nvm use --delete-prefix v6.10.3 --silent` to unset it.
How can i fix it? I am using node version v16.13.2 and npm 8.1.2 in macOs Monterey.

CircleCI fails at the fs-extra node_modules

I have been working on a project and recently, in Circle CI pipelines, I started to get this error.
/root/project/node_modules/fs-extra/lib/mkdirs/make-dir.js:85
} catch {
^
SyntaxError: Unexpected token {
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:617:28)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/root/project/node_modules/fs-extra/lib/mkdirs/index.js:3:44)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Function.Module._load (module.js:498:3)
at Module.require (module.js:597:17)
I see some discussions about it online.
https://github.com/google/docsy/issues/265
https://www.gitmemory.com/issue/jprichardson/node-fs-extra/790/614647362
The nodejs version is 12.16.1
The fs-extra version is 9.0.1, in the cases, it was mentioned as ^9.0.0.
Does anyone know where this error comes from, and how to fix it? It seems like I am aligned with my node version (over v10) and the fs-extra. I prefer not to downgrade unless it is the only solution atm.

nest js unable to create new application mac os

I'm trying to create new nestjs project using command nest new myApp
it's gives me
/usr/local/lib/node_modules/#nestjs/cli/node_modules/chalk/source/index.js:103
...styles,
^^^
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> (/usr/local/lib/node_modules/#nestjs/cli/commands/command.loader.js:3:15)
I'm using mac os
I needed to update my nodejs as prerequisite from the documentation
Prerequisites# Please make sure that Node.js (>= 10.13.0) is installed on your operating system.

Yeoman fails to run

I'm on centos 7 and I just installed nodejs version 6.14.3, npm version 3.10.10, and yo version 2.0.5. I then ran the command
yo code
In an attempt to use the yeoman generator to create a vscode extension. I then got the following error:
/usr/lib/node_modules/generator-code/generators/app/index.js:47
async prompting() {
^^^^^^^^^
SyntaxError: Unexpected identifier
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.get [as code:app] (/usr/lib/node_modules/yo/node_modules/yeoman-environment/lib/store.js:39:27)
Not sure if I'm just missing a silly dependency or something. Any ideas?
This node version, 6.X, doesn't support asyncs.
Definitely install a newer version, I recommend at least 8.X to not to risk other incompatibilities at the language level.

Error in angular2 cli installation

I am installing angular2 in linux with
sudo npm install -g #angular/cli
and after running that it successifully installs but after typing
ng new mynewapp
Am getting an error
/usr/local/lib/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:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/usr/local/lib/node_modules/#angular/cli/models/config.js:3:18)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
what could be wrong
It's seem your nodejs version does not support ES2015, update your node to version 6+
you can using nvm to manage your node version
Your need Node version 6.x or higher
See documentation below
take a look here: https://github.com/angular/angular-cli/issues/4604

Resources