Running gulp server returns Unexpected token - node.js

I successfully run this pdf viewer from mozilla/pdf.js to my windows. But when I'm trying to install it to my centos 7 machine I'm getting this error when running gulp server.
[root#localhost pdf.js]# gulp server
/root/Desktop/node.prod/pdf.js/gulpfile.js:232
output.library?.type === "module" ? { outputModule: true } : undefined;
^
SyntaxError: Unexpected token .
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at requireOrImport (/usr/lib/node_modules/gulp/node_modules/gulp-cli/lib/shared/require-or-import.js:19:11)
at execute (/usr/lib/node_modules/gulp/node_modules/gulp-cli/lib/versioned/^4.0.0/index.js:37:3)
at Liftoff.handleArguments (/usr/lib/node_modules/gulp/node_modules/gulp-cli/index.js:211:24)

Related

SyntaxError: Unexpected token when trying to run ssh on Google Cloud

I am trying to run an SSH on Google Cloud, and I am using node.js.
When I am trying to write node app.js in the ssh console (Ubuntu), I am getting this error:
SyntaxError: Unexpected token =
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:692:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (/home/bdognames/serverSystem/msg-system-server/logic/usersLogic.js:3:20)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
The strange part is, when I am running this code on my PC, it works just fine. Can someone please help ?

Unable to execute Sudo npm run dev

I am trying to install coreui admin theme for laravel project, when I run sudo npm run dev it give me error
/usr/lib/node_modules/webpack-cli/node_modules/pkg-dir/index.js:5
const pkgDir = async cwd => {
^^^
SyntaxError: Unexpected identifier
at NativeCompileCache._moduleCompile (/usr/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:240:18)
at Module._compile (/usr/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:184:36)
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 (/usr/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at Object.<anonymous> (/usr/lib/node_modules/webpack-cli/node_modules/import-local/index.js:4:16)
at Module._compile (/usr/lib/node_modules/webpack-cli/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
Can you let me know what should I do to over some above error.

ERROR Plugin load failed: hexo-deployer-git when I deploy the blog

Git, node, hexo are all installed correctly.But when I installed hexo-deployer-git, all the hexo commands will have the following problems. Is this a problem with the plugin? How should I solve it?
The following is an error message, can you help me?
'''
$ hexo d
ERROR Plugin load failed: hexo-deployer-git
D:\blog\node_modules\picomatch\lib\picomatch.js:54
let ignoreOpts = { ...options, ignore: null, onMatch: null, onResult: null };
^^^
SyntaxError: Unexpected token ...
at createScript (vm.js:53:10)
at Object.runInThisContext (vm.js:95:10)
at Module._compile (module.js:543:28)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\blog\node_modules\picomatch\index.js:3:18)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (D:\blog\node_modules\hexo-deployer-git\node_modules\readdirp\index.js:6:19)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
ERROR Deployer not found: git
'''
You may be running an older version of Node that doesn't support that syntax. The SyntaxError is being caused by the spread operator ..., which is supported in Node versions 8.3 or later.
To check your Node version run node -v in a terminal window.

Socket io 2.0.4 Cannot find module './utf8' (Heroku)

I try to install and run a simple app with nodeJs socket io and heroku.When i run the app locally i get no errors but when i try to run the app on heroku i get the following error :
Error: Cannot find module './utf8'
at Function.Module._resolveFilename (module.js:489:15)
at Function.Module._load (module.js:439:25)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/app/node_modules/engine.io-parser/lib/index.js:5:12)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
at tryModuleLoad (module.js:470:12)
at Function.Module._load (module.js:462:3)
at Module.require (module.js:517:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/app/node_modules/engine.io-parser/index.js:2:18)
at Module._compile (module.js:573:30)
at Object.Module._extensions..js (module.js:584:10)
at Module.load (module.js:507:32)
Ι navigated with heroku console inside node_modules/enine.io-parser/lib and the utf8.js file was missing.When i downgraded socket-io to version 1.7 the error disappeared.
Is there any solution on how to run socket-io 2.0.4 with Heroku?

Gulp SintaxError : Unexpected identifier

I try to edit a Gulp app on my local server.
I thought it could something with ES6 or version, but I tried so hard and nothing.
I always have this error:
/var/www/html/carros/gulpfile.js:11
let dev = true;
^^^
SyntaxError: Unexpected identifier
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Liftoff.handleArguments (/usr/local/lib/node_modules/gulp/bin/gulp.js:116:3)
at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:198:16)
at module.exports (/usr/local/lib/node_modules/gulp/node_modules/liftoff/node_modules/flagged-respawn/index.js:17:3)
at Liftoff.<anonymous> (/usr/local/lib/node_modules/gulp/node_modules/liftoff/index.js:190:9)

Resources