unexpected token < - node.js

Using the nodejs v.6.7 with faye v.7.1 I am getting error
/path/livestats/node_modules/faye0.7/faye.js:18
ID_LENGTH: <%= Faye::ID_LENGTH %>,
^
-----------------------
Exception: SyntaxError: Unexpected token <
SyntaxError: Unexpected token <
at Module._compile (module.js:427:25)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
at Function._load (module.js:310:12)
at Module.require (module.js:357:17)
at require (module.js:368:17)
at Object.<anonymous> (/path/livestats/lib/livestats.js:4:12)
at Module._compile (module.js:432:26)
at Object..js (module.js:450:10)
at Module.load (module.js:351:31)
-----------------------
I am trying to implement example showing in peepcode's Meet node.js video.

Seems like you requiring faye.js as is before building faye_node.
You need to follow instructions on faye repository or installing it via npm:
npm install faye -d
If you install it via NPM you can require("faye-node")

Related

SyntaxError: Unexpected token { at exports.runInThisContext (vm.js:53:16) in elasticdump

I was trying to move elasticsearch data from one server to another using elasticdump. When I giving
elasticdump --input=http://192.168.0.122:9200/my_index --output=http://localhost:9200/my_index --type=mapping
/usr/local/lib/node_modules/elasticdump/lib/transports/elasticsearch.js:668
var { awsChain, awsAccessKeyId, awsIniFileProfile } =
self.parent.options
^
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 getIo (/usr/local/lib/node_modules/elasticdump/lib/ioHelper.js:29:18)
at new elasticdump (/usr/local/lib/node_modules/elasticdump/elasticdump.js:43:3)
at Object. (/usr/local/lib/node_modules/elasticdump/bin/elasticdump:96:16)
How should I solve this error?
The problem is that your version of Node.js is too old and doesn't support the latest features.
elasticdump requires at least node.js v8+, so you should upgrade node.js and then it should work.

NodeJS Error In Constructor Language Only Present On Ubuntu

I am trying to get a particular npm package to run on Ubuntu 16.04. I am currently running the most up-to-date versions of nodejs and npm, as well as the package (turndown).
Here is the error that I get:
root#ubuntu-s-1vcpu-1gb-nyc1-01:/usr/server# nodejs index.js
/usr/server/node_modules/jsdom/lib/api.js:10
const { URL } = require("whatwg-url");
^
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 createHTMLParser (/usr/server/node_modules/turndown/lib/turndown.cjs.js:529:17)
at Object.<anonymous> (/usr/server/node_modules/turndown/lib/turndown.cjs.js:537:60)
at Module._compile (module.js:410:26)
The error states it occurs within the "turndown" package and is due to the language in the constructor. What is confusing to me is that this runs on Fedora 27 without error.
What could be causing the difference in behavior?
The answer to this question was to update my version of NodeJS. I ran into another error now, but it is package related.

Universal Angular 4: getting SyntaxError while using ng2 nouislider

I am working on Universal Angular 4 project.
while adding "nouislider" in html file,i am getting the following error
import * as i0 from '#angular/core';
SyntaxError: Unexpected token import
at createScript (vm.js:74:10)
at Object.runInThisContext (vm.js:116:10)
at Module._compile (module.js:533:28)
at Module._extensions..js (module.js:580:10)
at Object.require.extensions.(anonymous function) [as .ts] (/home/user/Desktop//node_modules/ts-node/src/index.ts:384:14)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
slider is working fine when i am working on angular 4 only i.e without server side rendering(SSR) but getting above error when doing SSR.
Please help me to get out of this.Thanks in Advance.

Unable to lift the sails.js app

I am unable to run my sails.js app. When I tried sails lift, it throws the following error. Is there anything else need to be done?
C:\my_project_path\config\._blueprints.js:1
(function (exports, require, module, __filename, __dirname) {
^
SyntaxError: Unexpected token ILLEGAL
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 C:\Users\Raghav Mac\Desktop\FiZZ\web-service-master\node_modules\include-all\index.js:129:29
at Array.forEach (native)
at requireAll (C:\Users\Raghav Mac\Desktop\FiZZ\web-service-master\node_modules\include-all\index.js:44:9)
at buildDictionary (C:\Users\Raghav Mac\Desktop\FiZZ\web-service-master\node
_modules\sails\node_modules\sails-build-dictionary\index.js:68:14)
at Function.module.exports.aggregate (C:\Users\Raghav Mac\Desktop\FiZZ\web-service-master\node_modules\sails\node_modules\sails-build-dictionary\index.js:190:9)
at Array.loadOtherConfigFiles [as 0] (C:\Users\Raghav Mac\Desktop\FiZZ\web-s
ervice-master\node_modules\sails\lib\hooks\moduleloader\index.js:164:27)
at C:\Users\Raghav Mac\Desktop\FiZZ\web-service-master\node_modules\sails\node_modules\async\lib\async.js:484:38
at _each (C:\Users\Raghav Mac\Desktop\FiZZ\web-service-master\node_modules\sails\node_modules\async\lib\async.js:46:13)
at Object.async.auto (C:\Users\Raghav Mac\Desktop\FiZZ\web-service-master\node_modules\sails\node_modules\async\lib\async.js:455:9)
at Hook.loadUserConfig (C:\Users\Raghav Mac\Desktop\FiZZ\web-service-master\node_modules\sails\lib\hooks\moduleloader\index.js:160:13)
Need help with this, thanks in advance.
Thanks to Adam William Larson for the answer.
Upgrade to node v0.11.. that might fix the issue, i'm pretty certain the latest version of sails only works with v0.11 or later.

Sails generate-oauth

I following this link sails-generate-oauth to generate oauth with sails, i follow and make all steps as in the refered page say but i am getting this error:
root#Ubuntu:~/sailTests/guatour# sails lift
info: Starting app...
/root/sailTests/guatour/config/routes.js:50
'get /login': 'AuthController.login',
^^^^^^^^^^^^
SyntaxError: Unexpected string
at exports.runInThisContext (vm.js:73:16)
at Module._compile (module.js:443:25)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at /usr/local/lib/node_modules/sails/node_modules/include- all/index.js:129:29
at Array.forEach (native)
at requireAll (/usr/local/lib/node_modules/sails/node_modules/include-all/index.js:44:9)
at buildDictionary (/root/sailTests/guatour/node_modules/sails/node_modules/sails-build-dictionary/index.js:68:14)
at Function.module.exports.aggregate (/root/sailTests/guatour/node_modules/sails/node_modules/sails-build-dictionary/index.js:190:9)
at Array.loadOtherConfigFiles (/root/sailTests/guatour/node_modules/sails/lib/hooks/moduleloader/index.js:164:27)
at /root/sailTests/guatour/node_modules/sails/node_modules/async/lib/async.js:484:38
at _each (/root/sailTests/guatour/node_modules/sails/node_modules/async/lib/async.js:46:13)
at Object.async.auto (/root/sailTests/guatour/node_modules/sails/node_modules/async/lib/async.js:455:9)
Am i missing something?
Thanks for your help, regards.
Sorry, i found my error, it was a coma, before the (/) route (default).

Resources