Example code is not working
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
- Can you give more details how to use node-compiler?
- I want to make my hapi server to binary file for distribution. In this situation, is the ENTRANCE for nodec app.js ?
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~
@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/
@kangchals Please let me know if it works now, thanks
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
@kangchals Sorry for the delay. I'll look into this ASAP.
@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.
It's working as per 845b547f71e0c83d6becc21bdbbdae39c152ce23

@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