Figma Support Forum

Additional folders needed for path when running build property in manifest.json

I’ve recently tried to use the build property of the manifest.json file which can execute a file when the plugin is published.

Unfortunately, when I try to publish the plugin I get the following error.

Build error: env: node: No such file or directory Path was: /usr/bin:/bin:/usr/sbin:/sbin

manifest.json

{
    // ...
    "build": "./bin/build"
}

bin/build

#! /usr/bin/env node

console.log("testing")

Upon further investigation, I can see that node gets installed by default under /usr/local/bin. Also if you use any version managers it could be installed somewhere else completely.

From what I understand on a Mac /usr/bin, /bin, /usr/sbin and /sbin are all protected by System Integrity Protection. This restricts a user by default from making changes to these directories and it’s generally not advised to not to disable it. Generally, customisations should be made in /usr/local.

I believe this is the reason why it is not working for me.

Does anyone have a suggestion to get around this issue?

Additionally, for Figma it would be great if Figma could look for the user’s $PATH or at the least add usr/local/bin as a directory to look in for executables.

I’ve just found the following that mentions Figma are aware that “the desktop app currently doesn’t set the PATH environment variable correctly”.

Workaround

As a workaround, I’ve followed the advice in the article above that mentions prefixing with an absolute path.

"build": "/usr/local/bin/node ./bin/build"

Although this is not ideal if you’re sharing your library with others who may have a different path to their node environment, so that’s just something to bear in mind.