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

req help, unexpected token error #16

Open
discoverlance-com opened this issue May 31, 2022 · 7 comments · May be fixed by #17
Open

req help, unexpected token error #16

discoverlance-com opened this issue May 31, 2022 · 7 comments · May be fixed by #17
Assignees
Labels
bug Something isn't working

Comments

@discoverlance-com
Copy link

Describe the bug
I installed the req command and tried it, had the following error.

To Reproduce
Steps to reproduce the behavior:

  1. Install the req cli with npm i -g req-cli
  2. Create a .req directory with a sample.http file
    GET https://api.github.com/users/SiddharthShyniben
  3. Run the command req run sample
  4. Also run the command req help
  5. See error
file:///home/user/.config/nvm/versions/node/v16.13.2/lib/node_modules/req-cli/src/index.js:41
                const {version} = (await import('../package.json', {assert: {type: 'json'}})).default
                                                                 ^

SyntaxError: Unexpected token ','
    at ESMLoader.moduleStrategy (node:internal/modules/esm/translators:139:18)
    at ESMLoader.moduleProvider (node:internal/modules/esm/loader:236:14)
    at async link (node:internal/modules/esm/module_job:67:21)

Expected behavior
A request should be sent with results on the github user's profile.

Versions (please complete the following information):

  • OS: [e.g. ChromeOS]
  • req: req version also gives the same error so cannot give detail here on the version of req in use
@discoverlance-com discoverlance-com added the bug Something isn't working label May 31, 2022
@rikongha
Copy link

rikongha commented Jun 24, 2022

I get similar experience, using v1.0.2

file:///Users/user/Library/Application%20Support/fnm/node-versions/v16.15.0/ins
tallation/lib/node_modules/req-cli/src/parse.js:49
                                throw new Error(`Error on line ${line}: Expected request line`);

@SiddharthShyniben
Copy link
Owner

@lance1997 What is your node.js version? it looks like your version does not support import

@rikongha You have a different error: your request file has invalid syntax (you probably forgot the HTTP version at the end)

@discoverlance-com
Copy link
Author

@lance1997 What is your node.js version? it looks like your version does not support import

@rikongha You have a different error: your request file has invalid syntax (you probably forgot the HTTP version at the end)

NodeJS Version is 16

@rikongha
Copy link

@lance1997 What is your node.js version? it looks like your version does not support import

@rikongha You have a different error: your request file has invalid syntax (you probably forgot the HTTP version at the end)

# Sample req file GET https://reqres.in/api/products/3 HTTP/1.1 here's what I've got in my file and node version is 16, I've tried 18 as well, same issue.

@SiddharthShyniben
Copy link
Owner

Very strange, cannot reproduce the issue. I'll look into this

@rmchale
Copy link

rmchale commented Jul 4, 2022

Screen Shot 2022-07-04 at 12 20 21 PM

Let me know what else you need.

@rmchale
Copy link

rmchale commented Jul 4, 2022

Is this the answer?

https://stackoverflow.com/a/62490732

@rmchale rmchale linked a pull request Jul 4, 2022 that will close this issue
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

Successfully merging a pull request may close this issue.

4 participants