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

Parse error #31

Closed
angelcnsk opened this issue Oct 11, 2019 · 6 comments
Closed

Parse error #31

angelcnsk opened this issue Oct 11, 2019 · 6 comments
Labels
stale No recent activity

Comments

@angelcnsk
Copy link

Bug description
Hi, I'm trying to npm run serve once the https-localhost dependency is installed to use ssl and it sends me the following compilation error message.

Failed to compile.

./node_modules/https-localhost/index.js 1:0
Module parse failed: Unexpected character '#' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> #!/usr/bin/env node
| 
| const path = require("path")

I put the following lines in my js file, I tried to find information about it but I can't solve the problem, I appreciate any possible help.

const app = require("https-localhost")()
// app is an express app, do what you usually do with express
app.listen(port)

System information (please complete the following information):

  • OS: MacOS X Mojave
  • App version 4.4.0
@daquinoaldo
Copy link
Owner

Hi @angelcnsk!

  • Which version of Node.js are you using? You can find it with node --version.
  • Are you running the script standalone from command line (i.e. serve my-folder) or are you using as module (e.g. const app = require("https-localhost")())?

@rzfzr
Copy link

rzfzr commented Oct 15, 2022

@daquinoaldo Greetings!
can you reopen the issue? It is still relevant, I'm encountering this.
node v16.16.0
using it as a module in an electron/vuejs app
I've used it in non-vue electron/ts app, so I believe it is something in the loader.
@angelcnsk did you solve it?

@rzfzr
Copy link

rzfzr commented Oct 15, 2022

Trying to remove the line gives this, is it looking for certs.js in the wrong place?
image
Have failed to use a shebang loader

@daquinoaldo daquinoaldo reopened this Oct 16, 2022
@daquinoaldo
Copy link
Owner

@rzfzr, can you try removing the shebang line from all the files and importing a local version of the module without shebangs? If it works, please open a pull request.

@wll8
Copy link

wll8 commented Nov 15, 2022

Since you are running npm run serve, you are consuming a web service. So you can put the following code in the browser runtime environment.

You can try to place the code for the node environment in vue.config.js.

@github-actions
Copy link
Contributor

Marked as stale for no activity in the past 60 days. In 7 days it will be closed unless new activity.

@github-actions github-actions bot added the stale No recent activity label Jan 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale No recent activity
Projects
None yet
Development

No branches or pull requests

4 participants