Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax Error upon import #24

Open
guyroyse opened this issue Feb 3, 2021 · 5 comments
Open

Syntax Error upon import #24

guyroyse opened this issue Feb 3, 2021 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@guyroyse
Copy link

guyroyse commented Feb 3, 2021

I'm getting a syntax error doing the simplest of things:

$ npm install --save redisai-js

I copy and paste the Vanilla JS tensor example from the README.md into a file named redisai-js.js. And then I run it:

$ node redisai-js.js

And it gives me this error:

/Users/guyroyse/code/redis-modules-assessment/node_modules/redisai-js/lib/tensor.js:49
    });
    ^

SyntaxError: Unexpected token '}'
    at wrapSafe (internal/modules/cjs/loader.js:931:16)
    at Module._compile (internal/modules/cjs/loader.js:979:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Users/guyroyse/code/redis-modules-assessment/node_modules/redisai-js/lib/index.js:10:16)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)

I pulled the repo down myself, built everything, and npm installed the folder on my machine and it worked. Seems like something wrong with our npm depoly? Maybe?

@filipecosta90 filipecosta90 self-assigned this Feb 4, 2021
@filipecosta90
Copy link
Collaborator

Hi there @guyroyse , I've created a empty project and used the sample tensor from the readme and it seems to work for me. Do we differ in any of the following versions?:

filipe@filipe-ThinkPad-T490:/tmp/test$ node --version
v14.13.0
filipe@filipe-ThinkPad-T490:/tmp/test$ npm list 
test@1.0.0 /tmp/test
└─┬ redisai-js@1.0.0
  ├─┬ @types/redis@2.8.28
  │ └── @types/node@14.14.25
  └─┬ redis@3.0.2
    ├── denque@1.5.0
    ├── redis-commands@1.6.0
    ├── redis-errors@1.2.0
    └─┬ redis-parser@3.0.0
      └── redis-errors@1.2.0 deduped

filipe@filipe-ThinkPad-T490:/tmp/test$ node tensor.js 
AI.TENSORSET result: OK
AI.TENSORGET reply: datatype FLOAT shape [1,2] , data [3,5]

@filipecosta90
Copy link
Collaborator

PS: nonetheless, to be sure, I can add the Readme examples to the CI as part of clean independent examples ( each of them ). wdyt?

@filipecosta90 filipecosta90 added the bug Something isn't working label Feb 4, 2021
@guyroyse
Copy link
Author

guyroyse commented Feb 4, 2021

That certainly couldn't hurt. I checked my version and stuff to compare and upgraded my Node from 12 to 14. But, still getting the error. This is really weird:

14:55:01 guyroyse@macaquebook.local ~/code/redisai-syntax-error 
🐵 node server.js 
/Users/guyroyse/code/redisai-syntax-error/node_modules/redisai-js/lib/tensor.js:49
    });
    ^

SyntaxError: Unexpected token '}'
    at wrapSafe (internal/modules/cjs/loader.js:979:16)
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/guyroyse/code/redisai-syntax-error/node_modules/redisai-js/lib/index.js:10:16)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
14:55:13 guyroyse@macaquebook.local ~/code/redisai-syntax-error 
🐵 node --version
v14.15.4
14:55:18 guyroyse@macaquebook.local ~/code/redisai-syntax-error 
🐵 npm list
redisai-syntax-error@1.0.0 /Users/guyroyse/code/redisai-syntax-error
└─┬ redisai-js@1.0.0
  ├─┬ @types/redis@2.8.28
  │ └── @types/node@14.14.25
  └─┬ redis@3.0.2
    ├── denque@1.5.0
    ├── redis-commands@1.6.0
    ├── redis-errors@1.2.0
    └─┬ redis-parser@3.0.0
      └── redis-errors@1.2.0 deduped

How did you install Node? I'm using nvm.

Note: Yes. I have a monkey in my command prompt. ;)

@leibale leibale self-assigned this May 3, 2021
@simonprickett
Copy link

I am able to reproduce @guyroyse findings using Mac OS Catalina 10.15.7 and Node 14.16.0, here's my output:

$ node server.js
/Users/simonprickett/source/github/redisai-syntax-error/node_modules/redisai-js/lib/tensor.js:49
    });
    ^

SyntaxError: Unexpected token '}'
    at wrapSafe (internal/modules/cjs/loader.js:979:16)
    at Module._compile (internal/modules/cjs/loader.js:1027:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/simonprickett/source/github/redisai-syntax-error/node_modules/redisai-js/lib/index.js:10:16)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
redisai-syntax-error $ vi /Users/simonprickett/source/github/redisai-syntax-error/node_modules/redisai-js/lib/tensor.js

@guyroyse
Copy link
Author

guyroyse commented May 3, 2021

I am running macOS Catalina 10.15.7 as well. I also experienced this same problem on an earlier Mac.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants