Forum Discussion

RobertT's avatar
7 years ago

How to Install the Lithium Community SDK on Windows

Hi All, 

 

After a bit of digging around, although not officially supported by Lithium yet I've worked out the process to install and use the Lithium Community SDK natively on Windows, the process is relatively straightforward as you'll see below, however it does take a little while for the dependencies to compile.

 

This works for Windows 7, 8 and 10:

 

  1. Install the latest stable version of NodeJS LTS (version 8.x) at the time of writing this post.
  2. Open Windows PowerShell as an Admin (right click and select Run as Administrator)
  3. run the following commands in powershell:
    1. npm install --production windows-build-tools  (note this will take a while to complete).

    2. npm install -g gulp 

    3. npm install -g lithium-sdk

 

After you finish the steps above, close PowerShell and re-open it as a regular user and you can continue to work as normal with the typical commands.

For more information see the Community SDK Documentation

  • Hi all,

     

    if like Denizbaby  you are having problems with rsync, and you have downloaded the cwrsync plugin mentioned by RobertT, be aware that the cwrsync package does not correctly install the cwrsync bin directory into windows 10 PATH variable.

    To fix this you need to put it there yourself.

    1. Download cwrsync - 64-bit version ; x86 version
    2. run the cwrsync file
    3. press the windows key and type 'env'
    4. Select 'Edit the system environment variables'
    5. click Environment variables at the bottom of the advanced tab that opens
    6. under system variables find Path and click it
    7. click edit or double click the path
    8. In the edit enviroment variable dialog click new
    9. you need to enter the full path to the bin folder which now exists in your cwrsync folder you just downloaded.
    10. Click ok
    11. Open Powershell
    12. type rsync --version

    If you get a version number you are done.

  • I have been trying to install this on Ubuntu via WSL in windows 10 and when I found this I was like .. OMG Thank good...

     

    It crashes in the same places as Ubuntu does. 

     

     

     win_delay_load_hook.cc
    Done Building Project "C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\node-sass\build\bind
    ing.vcxproj" (default targets) -- FAILED.
    
    Done Building Project "C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\node-sass\build\bind
    ing.vcxproj.metaproj" (default targets) -- FAILED.
    
    Done Building Project "C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\node-sass\build\bind
    ing.sln" (default targets) -- FAILED.
    
    C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\node-sass\build\binding.sln" (default targ
    et) (1) ->
    "C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\node-sass\build\binding.vcxproj.metaproj"
    (default target) (2) ->
    "C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\node-sass\build\binding.vcxproj" (default
    target) (4) ->
    (ClCompile target) ->
      c:\users\v-allens\appdata\roaming\npm\node_modules\lithium-sdk\node_modules\node-sass\src\create_string.cpp(17): erro
    r C2664: 'v8::String::Utf8Value::Utf8Value(const v8::String::Utf8Value &)': cannot convert argument 1 from 'v8::Local<v
    8::Value>' to 'const v8::String::Utf8Value &' [C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modu
    les\node-sass\build\binding.vcxproj]
    
        14 Warning(s)
        1 Error(s)
    
    Time Elapsed 00:01:05.20
    gyp ERR! build error
    gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
    gyp ERR! stack     at ChildProcess.onExit (C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\node-gyp\lib\build.js:262:23)
    gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
    gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
    gyp ERR! System Windows_NT 10.0.20170
    gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\v-allens\\AppData\\Roaming\\npm\\node_modules\\lithium-sdk\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
    gyp ERR! cwd C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\node-sass
    gyp ERR! node -v v12.18.3
    gyp ERR! node-gyp -v v3.8.0
    
    • RobertT's avatar
      RobertT
      Boss

      Hi Allen, 

      Looking at the error it seems it's not happy with Visual Studio when it comes to the node-gyp dependency part of the build. Visual Studio 2017 and later cause some issues unfortunately.

      I think I've seen this before, if I remember correctly there is a workaround. Can you try running the following command:

      npm install --global --production windows-build-tools --vs2015

      following this re-run the command to install the Lithium-SDK

      npm install -g lithium-sdk

      Hopefully that should work.

       

      • Well now I am in the same place as the last poster.. Install finished (thanks RobertT ) but li create-project failes as it says primordials is not defined

         

        any thoughts?

         

        PS C:\Users\v-allens\Plugin> li create-project
        fs.js:36
        } = primordials;
            ^
        
        ReferenceError: primordials is not defined
            at fs.js:36:5
            at req_ (C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\natives\index.js:143:24)
            at Object.req [as require] (C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\natives\index.js:55:10)
            at Object.<anonymous> (C:\Users\v-allens\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:37)
            at Module._compile (internal/modules/cjs/loader.js:1137:30)
            at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
            at Module.load (internal/modules/cjs/loader.js:985:32)
            at Function.Module._load (internal/modules/cjs/loader.js:878:14)
            at Module.require (internal/modules/cjs/loader.js:1025:19)
            at require (internal/modules/cjs/helpers.js:72:18)
  • Hi All,

      Thanks for the information RobertT .  I am getting some issues while  executing package-plugin command. Successfully installed and downloaded the projects from the  server in windows. But while executing the li plugin-package command getting the  below error.  

    Thanks  for the support.
    [15:35:02] ✗ FAIL: Missing 2 expected files: res, res/**
    [15:35:02] Tested 1 tests, 0 passes, 1 failures: FAIL
    [15:35:02] 'plugin-verify' errored after 31 ms
    [15:35:02] [gulp] Error in plugin 'stream-sync': Errors
    [Stream 2] Error in script 'gulp-expect-file': Failed 1 expectationsError.jpg

    Thanks,

     DVB

    • RobertT's avatar
      RobertT
      Boss

      Hi DVB,

      This error typically indicates that you're missing a dependency required for the SDK to run.

      In this case it is rsync that's missing, you can install cwRsync which is free for Windows.

      Once installed, open a Powershell window and type the following command to verify that rsync is installed properly

      rsync --version

       

      After you've done that, if you've exported the studio plugin from your community, you may need to export it again, then run li serve-sass to complete downloading any other core skin dependencies and precompile the skin to help with plugin validation when it comes time to submit it again.

       

      I hope this helps

  • You're my hero RobertT . Last time I did this was 2016 and this time around I couldn't get it to install properly; kept getting stuck installing the lithium plugin. Khoros support basically told me to go sort myself and that Windows isn't supported. This worked perfectly. Thank you!

  • RobertT

    I am getting error when running the command 

    npm install -g lithium-sdk

    See attached screenshot for logs.  I have installed all the required things. Any help would be appreciated. 

    • RobertT's avatar
      RobertT
      Boss

      VikasB

       

      It looks as if the Windows Build Tools haven't installed properly.  Try running the following command in PowerShell again as administrator

       

      npm install --production windows-build-tools

      It will take a while for the build tools to install, once complete run 

      npm install -g lithium-sdk

      Which should fix the issue.

       

       

      • VikasB's avatar
        VikasB
        Boss

        RobertT

        I followed the same steps you mentioned in this thread. 

        I have tried it multiple time on Powershell and cmd both(as administrator). Even reinstalled all the required things. But every time I am getting the same log. 

    • charan's avatar
      charan
      Guide

      I tried installing lithium-sdk in windows 10, windows-build-tools and gulp got installed without any issue and When i install lithium-sdk with the below command

      npm install -g lithium-sdk

      i am getting this below error, (note: running as administrator in power shell) lithium-error.PNG

       

      npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'C:\Users\rajakc\AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\watchpack\node_modules\fsevents\node_modules\yallist' -> 'C:\Users\rajakc\
      AppData\Roaming\npm\node_modules\lithium-sdk\node_modules\watchpack\node_modules\fsevents\node_modules\.yallist.DELETE'
      
      npm ERR! code EEXIST
      npm ERR! path C:\Users\rajakc\AppData\Roaming\npm\node_modules\lithium-sdk\bin\li.js
      npm ERR! dest C:\Users\rajakc\AppData\Roaming\npm\li
      npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\rajakc\AppData\Roaming\npm\node_modules\lithium-sdk\bin\li.js' -> 'C:\Users\rajakc\AppData\Roaming\npm\li'
      npm ERR! File exists: C:\Users\rajakc\AppData\Roaming\npm\li
      npm ERR! Remove the existing file and try again, or run npm
      npm ERR! with --force to overwrite files recklessly.
      
      npm ERR! A complete log of this run can be found in:
      npm ERR!     C:\Users\rajakc\AppData\Roaming\npm-cache\_logs\2020-04-02T17_59_10_850Z-debug.log

      Any solutions?

      • RobertT's avatar
        RobertT
        Boss

        charan have you used NodeJS on your machine prior to attempting to install the SDK and if so what version of NodeJS is currently installed alongside npm?

        You can check this by running the following commands in powershell

        node -v
        npm -v

         

        If you're using NodeJS 8.3.0 and are not relying on it for anything else other than the SDK you might be able to get the SDK to install by running it with the --force flag.

        npm install -g lithium-sdk --force