Error: Unable to load code: Error in Development mode

Hi,

I’m having issues running my plugin locally in development.

The verbose I get in the console sheds no light on what the issue is.

The plugin I’m trying to run is “Design Lint” which uses a standard Figma Plugin React Template.

Note:

I’ve had to add export SET NODE_OPTIONS=--openssl-legacy-provider to the yarn build:watch command to allow it to build Webpack for arm-64 M1 chips, instead of x84-64 by default

This is the error I’m getting when importing the plugin’s manifest and executing it In Development mode:


I’ve looked at the minified files and couldn’t find much clarity besides a vague error message regarding the manifest, but it seem to work just fine on the Published version so I don’t think there should be anything missing there.

The issue seem to only happen on my M1 Max, but runs just fine on my M1 Pro. I’ve tried uninstalling Figma completely (using the available uninstall.sh on Figma’s website), I’ve completely removed nodejs and reinstalled cleanly with nvm, but the issue still persists, making it impossible for me to run the plugin on this machine.

On the other hand, the New Plugin template (that creates 5 rectangles) generated through the Figma app does run just fine in development mode on this machine.

My dev env:
Apple M1 Max Ventura 13.2.1
node v18.4.2
yarn v1.22.19
xcode-select v2396

Any guidance on where I should be looking to debug this issue would be greatly appreciated. :pray::smile:

1 Like

What’s the path to code.js in manifest.json and where is code.js actually located? It should be at the correct path relative to manifest.

code.js is located at the root, inside a generated dist folder. the path for it in manifest.json points correctly to dist/code.js.

I’ve tried running it on a colleague’s M1 Max and it worked, so it’s definitely just an environment issue on my machine, some dependencies missing/breaking in the background.

Maybe try removing the plugin and then adding it to Figma again? Other than that no idea what can help

1 Like

I figured it out!! When I first installed Figma on this machine, I must have accidentally dismissed the Privacy Permission prompt… I went to System Settings > Privacy > Files and Folders > Figma and toggled Documents Folder.

After restarting Figma it magically worked as expected :sparkles::tada:

Thanks for taking the time to reply to this thread, case is resolved!

2 Likes