Closed animetronix closed 7 years ago
Hum, does sjs ./bar.js
work? At any rate, I plan on updating the Duktape engine to v2 soon, I'll also take care of this before the release. Thanks for the report!
@saghul clobbered and rebuilt sjs, this specific error went away but a related one showed up:
$ cat foo.js
module.exports = "bar";
$ cat bar.js
console.log(require("./foo"));
$ sjs bar.js
bar
$ sjs -e 'require("./foo.js")'
Error: Module not found
...
It seems like the module resolution process from the REPL differs from the module resolution process for a script invocation and the process for the eval mode.
Looks like this got fixed somewhere along the line, I can no longer reproduce it.
I had the same problem like @animetronix.
Please look into Makefile and you will see that the runnable REPL command is make run
. It indicates that you should export the environment variable SJS_PATH=build:modules
so that no matter you get into REPL with ./build/sjs
(not make run
) or run script file as $ ./build/sjs foo.js
, all module could be found.
Best to explain with an example: