NPM / Yarn

EACCES permission errors while attempting to install packages globally

When you try to install a package globally (without using the --unsafe-perm option), you might encounter a few potential problems:

  • You won't be able to run the package without using sudo
  • npm employs the nobody user, which could cause unexpected behavior in certain situations

Don't install the command-line interface (CLI) as a root user. Instead, consider using a node version manager (e.g. nvm or n) or configuring npm to use a different default directory. As a quick fix, use the --unsafe-perm flag.

For a permanent solution, please refer to Resolving EACCES Permission Errors When Installing Global Packages.

"The module '' was compiled for a different version of Node.js" error while attempting to run Bright CLI

If you update your Node.js version (e.g. through automatic updates), you'll need to reinstall the CLI to rebuild dependencies with the new Node.js SDK. If you don't, you might encounter this error when trying to start:

Error: The module '<some-path-to-file>'  
was compiled for a different version of Node.js. It was compiled using  
NODE_MODULE_VERSION X, but this version of Node.js needs  
NODE_MODULE_VERSION Y. Try recompiling or reinstalling  
the module (for example, using 'npm rebuild' or 'npm install')

"gyp failed with exit code: 1" during the execution of npm install or while building native add-ons

Certain npm versions might include a buggy built-in version of node-gyp, which compiles native add-ons. For instance, you might see an error like this:

npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! gyp: C:\Users\runneradmin\AppData\Local\node-gyp\Cache\18.17.0\common.gypi not found (cwd: D:\a\bright-cli\bright-cli\node_modules\@neuralegion\os-service) while reading includes of binding.gyp while attempting to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (C:\hostedtoolcache\windows\node\18.17.0\x64\node_modules\npm\node_modules\node-gyp\lib\configure.js:325:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:514:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)

For a permanent solution please refer to Mitigating Problems with Built-in Node-gyp