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

Example code is not working #59

Open
kangchals opened this issue Jul 7, 2017 · 8 comments
Open

Example code is not working #59

kangchals opened this issue Jul 7, 2017 · 8 comments

Comments

@kangchals
Copy link

Hello,

I tried to use node-compiler but I failed to run example code

git clone --depth 1 https://github.com/eggjs/examples.git
cd examples/helloworld
npm install
nodec node_modules/.bin/egg-bin
./a.out dev (or a.exe dev on Windows)

npm install was fine but nodec node_modules/.bin/egg-bin emit error like below
Cannot find entrance C:/Users/kangcs.SOLID/myTest/examples/node_modules/.bin/egg-bin.

Thank you!

Additional Questions

  1. Can you give more details how to use node-compiler?
  2. I want to make my hapi server to binary file for distribution. In this situation, is the ENTRANCE for nodec app.js ?
@kangchals
Copy link
Author

It very is nice to check the issue very quickly. Good.
I want to give more information on the environment.
The OS is windows10 and I follow the installing step carefully.
Thank you~

@pmq20
Copy link
Owner

pmq20 commented Jul 8, 2017

@kangchals I think the problem is that you have cd'ed into C:/Users/kangcs.SOLID/myTest/examples instead of C:/Users/kangcs.SOLID/myTest/examples/helloworld.

I have not used hapi.js before but a glance onto the document shows that you should probably set the ENTRANCE to be server.js as in the example of https://hapijs.com/

@pmq20
Copy link
Owner

pmq20 commented Jul 8, 2017

@kangchals Please let me know if it works now, thanks

@kangchals
Copy link
Author

Sorry, my mistake...

Now, nodec node_modules/.bin/egg-bin works fine after I add global path for sqfs43-win32.

The result of nodec is a.exe, However, it is not working.

After executing a.exe, the error message is showing like below.

C:\Users\kangcs.SOLID\myTest\examples\helloworld>a.exe
C:\__enclose_io_memfs__\node_modules\.bin\egg-bin:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at createScript (vm.js:74:10)
    at Object.runInThisContext (vm.js:116:10)
    at Module._compile (module.js:533:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:162:16)
    at bootstrap_node.js:579:3

@pmq20
Copy link
Owner

pmq20 commented Jul 20, 2017

@kangchals Sorry for the delay. I'll look into this ASAP.

@pmq20
Copy link
Owner

pmq20 commented Jul 26, 2017

@kangchals It turns out that the entrance is not a valid JavaScript file. node_modules/.bin/egg-bin and node_modules/.bin/egg-bin.cmd are actually shell scripts and batch programs (or symbolic links in some cases) that all point to node_modules/egg-bin/bin/egg-bin.js.

Running it with the real entrance fixes the problem, i.e. nodec node_modules/egg-bin/bin/egg-bin.js.

pmq20 added a commit that referenced this issue Jul 26, 2017
@pmq20
Copy link
Owner

pmq20 commented Jul 26, 2017

It's working as per 845b547

image

@wind13
Copy link

wind13 commented Aug 10, 2018

@pmq20 I don't think a.out can work without source code. What if you try this:

mv ./a.out ~/temp/

And then go to temp run again:

cd ~/temp/
./a.out dev

It will get this error:

⚠️  AssertionError [ERR_ASSERTION]: /Users/yourname/temp/package.json should exist
⚠️  Command Error, enable `DEBUG=common-bin` for detail

See also this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants