Syntax error on async function as object field - javascript

I'm have a problem on the simple Getting started tutorial of FeathersJS.
I copy/past both code and run the server, but it return me a Syntax Error on client.js line 5:
app.use('todos', {
async get(name) {
^^^^^^^^^^^^^^^^^
> Uncaught SyntaxError: Unexpected identifier
What did I miss ?
EDIT: I forgot to say that error come from the browser after I run
http-server public/

Related

How to fix the jest SyntaxError: Unexpected token '||='

Here is my code which work nice in browser:
addon.addonRun ||= () => { };
But when I run unit tests in jest, I get this error:
SyntaxError: Unexpected token '||='
How to fix this error ?

Node 14 + Jest + ESM leads to maximum call stack size error. Before it was unexpected token error. How to fix?

I have a backend project on Node js. Right now installed Node 14. So I have Jest and want to test functions from the auth.js file. So I create auth.test.js and import login from '../auth.js 0 got unexpected token error.
Then I do the trick with esm according to the node documentation
So I hade "type":module" in my package.json file, but it didn't provide any result.
So now I did this:
const esmImport = require('esm')(module);
const login = esmImport('../src/controllers/auth')(module);
test('Auth login', () => {
let result = 'OK';
expect(result).toBe('OK')
})
And the error is:
FAIL test/auth.test.js
● Test suite failed to run
D:\Programming\Anami\anami-backend\node_modules\wkx\lib\point.js:1
RangeError: Maximum call stack size exceeded
Any help how to fix this issue?

Typescript compiler failing with strange error

I'm getting the following error:
events.js:141
throw er; // Unhandled 'error' event
^
TypeScript error: node_modules/gulp-typescript/release/compiler.d.ts(32,22): Error TS1005: '=' expected.
My gulpfile https://github.com/rtaycher/2048-Clone/blob/master/gulpfile.js
I also have a declaration file global.d.ts:
interface Array<T> {
includes(searchElement: T) : boolean;
}
Some googling indicates that declaration files might cause issues.
Error TS1005: '=' expected
The error is two fold.
an old version of the definition file e.g. this verion has readonly https://github.com/ivogabe/gulp-typescript/blob/3645edb57278a22e08e6ae9780dc09b8ae68003e/release/compiler.d.ts#L32
an old version of the compiler that doesn't support new keywords (like readonly).
Personal opinion
Please use TypeScript nightlies otherwise it will always be an uphill / confusing battle. 🌹

Reserved Word error

I have the following piece of code in Coffee-script
class #Badge
setIssues: (count)->
#count = count
#render()
When I run my script, I get the following error ,
Uncaught Syntax-Error: Unexpected reserved word
I am complete newbie in Coffee-script , so totally off-guard as of how to fix this error
I tried removing the word 'class' , hence removing the first line(including #Badge), as it is mentioned here , that 'class' is a reserved word . On doing so , it resulted in the error ,
Uncaught SyntaxError: Unexpected token >
How can i fix this error ?
Your two errors:
Uncaught Syntax-Error: Unexpected reserved word
Uncaught SyntaxError: Unexpected token >
suggest that you're trying to run CoffeeScript code as though it was JavaScript. You need to compile your CoffeeScript to JavaScript before you can run it in a JavaScript environment.
See the fine manual for details:
Usage
"text/coffeescript" Script Tags

Sencha touch production build errors

Using touch 2.1.0 and Cmd 3.1.2.342
Whilst trying to create a production version of my sencha app, I get the following error:
[WRN] C1003: Unsupported Ext.define syntax -- C:\wamp\www\touch-2.1.0\axis\nativ
e\appname\touch\src\fx\TimingFunctions.js:109
[ERR] C2008: Requirement had no matching files (Ext.fx.TimingFunctions) -- C:\wa
mp\www\touch-2.1.0\axis\native\appname\touch\src\fx\Abstract.js:959
[ERR] The following error occurred while executing this line:
C:\wamp\www\touch-2.1.0\axis\native\appname.sencha\app\build-impl.xml:165:
It seems to me that it is saying a file called fx/TimingFunctions.js is required by fx/Abstract.js but cannot be found. However, this can't be what it means as the file exists in that folder.
The command I am using is:
sencha app build production
Line 109 of TimingFunctions.js looks like this:
Ext.define('Ext.fx.TimingFunctions', Ext.apply({
singleton: true,...
One solution is to change line 109 of TimingFunctions.js from:
Ext.define('Ext.fx.TimingFunctions', Ext.apply({
to:
Ext.define('Ext.fx.TimingFunctions', {
and change line 136 of the same file from:
}, EasingPrototype));
to:
}, EasingPrototype);
This then allows the build to go ahead.
However, when I then view the production app in the web browser, it freezes and I get the following error
Uncaught TypeError: Object # has no method 'call' process sencha-touch-all-debug.js:6767
(anonymous function) process sencha-touch-all-debug.js:6774
(anonymous function) sencha-touch-all-debug.js:6779
Ext.apply.onBeforeCreated sencha-touch-all-debug.js:5196
process sencha-touch-all-debug.js:5262
process sencha-touch-all-debug.js:5268
process sencha-touch-all-debug.js:5268
process sencha-touch-all-debug.js:5268
Ext.apply.process sencha-touch-all-debug.js:5272
Ext.Class.ExtClass sencha-touch-all-debug.js:5183
Ext.ClassManager.create sencha-touch-all-debug.js:6725
Ext.apply.define sencha-touch-all-debug.js:7407
(anonymous function) TimingFunctions.js?_dc=1379403994382:109
(anonymous function) TimingFunctions.js?_dc=1379403994382:138
There was a spelling mistake in the files fx/Abstract.js and fx/TimingFunctions.js
Actually, it's not a spelling mistake - more like a grammatical error.
Abstract.js calls a function in TimingFunctions.js. in Abstract.js it is referred to as EasingMap, where as in TimingFunctions.js it is called easingMap

Categories