Debugging the SuiteCloud SDF Installation for Mac

In Part 1 of this series, we said SDF installation could sometimes fail. One reason for failure, a nerve-racking error, is the EACCES permissions error when you run npm i -g @oracle/suitecloud-cli.

How to Fix the EACCES NPM Install Error

The most natural thing to do with a permissions error like the EACCES error is to override it by slapping sudo on the front of your command. With npm, however, this is the last thing you should do.

If you do, you might see this:

In file included from ../src/libsass/src/subset_map.cpp:2:
../src/libsass/src/ast.hpp:1614:25: warning: loop variable 'numerator' of type 'const
      std::__1::basic_string<char>' creates a copy from type 'const
      std::__1::basic_string<char>' [-Wrange-loop-analysis]
        for (const auto numerator : numerators)
../src/libsass/src/ast.hpp:1614:14: note: use reference type 'const
      std::__1::basic_string<char> &' to prevent copying
        for (const auto numerator : numerators)
../src/libsass/src/ast.hpp:1616:25: warning: loop variable 'denominator' of type 'const
      std::__1::basic_string<char>' creates a copy from type 'const
      std::__1::basic_string<char>' [-Wrange-loop-analysis]
        for (const auto denominator : denominators)
../src/libsass/src/ast.hpp:1616:14: note: use reference type 'const
      std::__1::basic_string<char> &' to prevent copying
        for (const auto denominator : denominators)

There is a better way. The npm solution consists of two options.

  1. First, use a node version manager to re-install npm.
  2. Then, manually configure where npm installs its global modules.

We’ll use the second option.

Configuring the Location for NPM Global Installs

1. Make sure your machine has the recommended version of npm.

     a. Check the node installation page for the version Recommended For Most Users.

     b. Check which node version you have by running node -v in your terminal.

     c. If your version isn’t the recommended one, install the recommended one.

2. Create a new folder in your home directory.

mkdir ~/.npm-global   #<- or whatever name you fancy

3. Change the global directory for npm installations:

npm config set prefix '~/.npm-global' #<-or the name you chose

4. Create a new file called .profile in the home directory and populate it with:

echo export PATH=~/.npm-global/bin:\$PATH > ~/.profile

5. To update the PATH system variable, run:

source ~/.profile

Verify That NPM Installs SDF Correctly

Now you are ready to install SDF by running npm i -g @oracle/suitecloud-cli. When installation is complete, run suitecloud and you should see the following output:

SuiteCloud CLI for Node.js (NetSuite 2021.1)
Usage: suitecloud command [option]

  --version                            output the version number
  -i, --interactive                    run the command in interactive mode
  -h, --help                           display help for command

  account:manageauth [options]         Manages authentication IDs (authID) for all your projects. An authentication ID is a custom alias you gave to a specific
                                       account-role combination.
  account:savetoken [options]          Saves a TBA token that you issued previously in NetSuite.
  account:setup [options]              Sets up an account to use with the SuiteCloud CLI for Node.js.
  config:proxy [options]               Configures a proxy server.
  file:import [options]                Imports files from an account to your account customization project. You cannot import files from a SuiteApp.
  file:list [options]                  Lists the files in the File Cabinet of your account.
  file:upload [options]                Uploads files from your project to an account.
  object:import [options]              Imports custom objects from your NetSuite account to the SDF project. In account customization projects (ACP), if SuiteScript
                                       files are referenced in the custom objects you import, these files get imported by default.
  object:list [options]                Lists the custom objects deployed in an account.
  object:update [options]              Overwrites the custom objects in the project with the custom objects in an account.
  project:adddependencies              Adds the missing dependencies to the manifest file.
  project:create [options]             Creates a SuiteCloud project, either a SuiteApp or an account customization project (ACP).
  project:deploy [options]             Deploys the folder containing the project. The project folder is zipped before deployment, only including the files and folders
                                       referenced in the deploy.xml file.
  project:package [options]            Generates a ZIP file from your project, respecting the structure specified in the deploy.xml file, and applying local validation.
  project:validate [options]           Validates the folder containing the SuiteCloud project.
  suitecommerce:localserver [options]  Generates a local server of your SuiteCommerce extensions and themes. This set of compiled files is stored in your SuiteApp
                                       project folder and the server is located on port 7777. You can use this server to run and test the SuiteCommerce themes and
                                       extensions that you are developing.
  help [command]                       display help for command

The Catch

If running suitecloud results in: zsh: command not found: suitecloud,here are a couple steps you can take:

1. Go into the folder you created to hold the global npm installations. If needed, use “CMD + SHIFT + .” to show hidden folders.

2. Locate the @oracle folder and copy it.

3. Finally, paste the @oracle folder into /usr/local/lib/node_modules.

When you run suitecloud now, you should receive the above output.


We hope this post has been helpful! Don’t forget to subscribe below to our mailing list so you can receive more great scripting advice directly in your inbox each week!