cs-au-dk / jelly

JavaScript/TypeScript static analyzer for call graph construction, library usage pattern matching, and vulnerability exposure analysis
MIT License
317 stars 22 forks source link

Jelly Library Fails to Parse Cross-File Modules #15

Closed willowwy closed 6 months ago

willowwy commented 6 months ago

I attempted to implement Example1 from the paper associated with the Jelly library. This involved creating two separate files and importing modules from one file to another. Despite following the documentation's guidelines closely, Jelly is unable to parse the cross-file modules, resulting in an import failure. image

Actual Behavior

An error occurs during the parsing process. Error: Unable to resolve module image

I have attempted clearing the npm cache and reinstalling node_modules, but the issue persists. Node.js version: v20.0.0 NPM version:9.6.4

amoeller commented 6 months ago

You set -b . (sets the base directory to .) but analyze files in another directory. Try removing -b . or replacing . by D:\Study\Lab_NPM\try_jelly\test.

willowwy commented 6 months ago

I have retried your suggested solutions, but I'm still encountering the same issue as before, unable to resolve it. image

I've made multiple attempts, exploring all possible avenues, yet the problem persists.

node ../jelly/lib/main.js -j cg.json -b . D:\Study\Lab_NPM\try_jelly\test
node ../jelly/lib/main.js -j cg.json -b D:\Study\Lab_NPM\try_jelly\test D:\Study\Lab_NPM\try_jelly\test
node ../jelly/lib/main.js -j cg.json -b D:\Study\Lab_NPM\try_jelly\test .
node ../jelly/lib/main.js -j cg.json D:\Study\Lab_NPM\try_jelly\test
node ../jelly/lib/main.js -j cg.json .

jelly -j cg.json -b . D:\Study\Lab_NPM\try_jelly\test
jelly -j cg.json -b D:\Study\Lab_NPM\try_jelly\test D:\Study\Lab_NPM\try_jelly\test
jelly -j cg.json -b D:\Study\Lab_NPM\try_jelly\test .
jelly -j cg.json D:\Study\Lab_NPM\try_jelly\test
jelly -j cg.json .

Additionally, I've provided the structure of my files for a clearer understanding of the setup:

try_jelly
├─ jelly
│  └─ ……
└─ test
   ├─ cg.html
   ├─ cg.json
   ├─ clinet1.js
   ├─ lib1.js
   └─ package.json
amoeller commented 6 months ago

Maybe it's an issue with Windows vs. Linux file paths... Can you try on a Linux machine or via WSL? Meanwhile, we'll test it on Windows (we're mainly using Linux) :-)

willowwy commented 6 months ago

It turned out to be an issue with how Linux and Windows handle paths differently. After switching to Linux, everything runs smoothly now. Thanks a lot!

amoeller commented 5 months ago

Should be fixed by c197c6b.