Playcanvas-sync launching issue

I found a good module for working with playcanvas on a local IDE, which facilitates both the development and work with the git.
However, I did not quite understand exactly where to create a config file and did not find step-by-step instructions.
Here are the steps I follow:

  1. clone the playcanvas-sync repository
  2. in root of playcanvas-sync folder in the terminal I enter “npm install -g”
    Then I have an error “Error: Could not find any Visual Studio installation to use”, “You need to install the latest version of Visual Studio”. Is it required to install Visual Studio if I do not use it, but use, for example, websorm?
  3. in the root (folder playcanvas-sync) I create a file “.pcconfig”
  4. I write something like that there:
  "PLAYCANVAS_TARGET_DIR": "/ Users / zpaul / proj1",
  "PLAYCANVAS_BAD_FILE_REG": "^ \\. | ~ $",

in “PLAYCANVAS_TARGET_DIR” I write the path to the folder where potentially my project should be: “…/myProject”
and leave the fields “PLAYCANVAS_BAD_FILE_REG” and “PLAYCANVAS_BAD_FOLDER_REG” unchanged.
5) at the root of my project I initialize “npm init”, run “pcsync pullAll” and get an error: Cannot find module ‘…/…/build/Release/nsfw.node’ and nothing happens.

I will be grateful for the answer and explanation of what exactly I am doing wrong.

@zpaul One for you?

maybe someone else used this feature and could explain?

Before you move forward with the sync tool, you must ensure you can compile the file watching module nsfw, which depends on native module node-gyp. You can create an empty folder and run the following:

npm init -y
npm install nsfw

If you have errors compiling the module, you must resolve them. I have Visual Studio compiler, so I don’t have errors compiling it. I believe you don’t have to use Visual Studio, and other compilers can be used, like mingw. You can google your console error to find a solution.

Once you can install nsfw without errors, you can proceed with the sync tool setup. I would recommend not to use -g flag which installs the tool globally. Generally, try to keep modules locally, unless it is a global tool, like yarn for example.

  1. Config file.
    The tool will need to read the configuration properties, like your project ID, API key, etc. It can read them from multiple files, or from a single file. Depending on your OS, your home directory is different (under Windows it is usually in C:\Users\username).
    As such, you can create a .pcconfig in your home directory and add your API key and filtering rules there, e.g.:
  "PLAYCANVAS_API_KEY": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
  "PLAYCANVAS_BAD_FILE_REG": "^\\.|~$|jsconfig.json",
  "PLAYCANVAS_BAD_FOLDER_REG": "^\\.|typings"

And the rest of the configuration keep in pcconfig.json of your playcanvas-sync folder or what have you.

  1. Example:
  • Create a folder playcanvas

  • Go inside the playcanvas, and create a new folder for your project, e.g. example

  • Go to playcanvas root and clone the sync tool to it and install it

mkdir playcanvas
cd playcanvas
mkdir example
git clone
cd playcanvas-sync
npm install
  • Now, you should have the following folder structure:
 |- example
 |- playcnavas-sync
  • Go to your home dir and add .pcconfig file, as in the above example.
  • Go to your playcanvas-sync folder and add a pcconfig.json:
  "PLAYCANVAS_BRANCH_ID": "xxxxxxxxxxxx",
  "PLAYCANVAS_TARGET_DIR": "../example"

Now you should be ready to use the pcsync, e.g. from playcanvas-sync folder run pcsync pullAll and it should pull all your project files to the example directory.

1 Like