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

equire' is not defined #10

Open
xifengiOS opened this issue May 19, 2023 · 2 comments
Open

equire' is not defined #10

xifengiOS opened this issue May 19, 2023 · 2 comments

Comments

@xifengiOS
Copy link

ReferenceError: 'require' is not defined
at (loader.js:1)

@jpstotz
Copy link

jpstotz commented Nov 1, 2023

I was also getting this error when performing the build commands on Windows 10.

Switching to Linux/WSL made this problem disappear:
On Linux:
First install nvm.

git clone https://github.com/frida/frida-swift-bridge.git
cd frida-swift-bridge
nvm install 20
nvm use 20
npm install
npm run watch

That creates in my environment an _agent.js that does not cause the error ReferenceError: 'require' is not defined.

@jpstotz
Copy link

jpstotz commented Nov 1, 2023

I finally managed to build frida-swift-bridge on Windows. The problem may be caused by older versions of tsc and frida-compile that have been installed globally. So you just have to make sure to use the versions of tsc and frida-compile that are installed locally into node_modules\.bin directory by the npm install command:

Just compile (no watch and automatic recompile in case of source files changes) execute:

git clone https://github.com/frida/frida-swift-bridge.git
cd frida-swift-bridge
npm install
.\node_modules\.bin\tsc.cmd
.\node_modules\.bin\frida-compile -o _agent.js loader.js

You can see that it had worked by the size of the generated _agent.js. The defect version which causes ReferenceError: 'require' is not defined has ~1 KB. The correct version has 145 KB.

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

2 participants