Search code examples
node.jsnpmloopbackjs

Trouble in installing loopback on windows


After running the command :

npm install -g loopback-cli

I am getting this output:

C:\>npm install -g loopback-cli npm WARN deprecated swagger-ui@2.2.10:
   No longer maintained, please upgrade to swagger-ui@3. 
D:\project\IOT-KT\infra\nfr-iot-md\testSpecs\nodejs\node_modules\windows-build-tools\lb
D:\project\IOT-KT\infra\nfr-iot-md\testSpecs\nodejs\node_modules\windows-build-tools\node_modules\loopback-cli\bin\loopback-cli.js
loopback-cli@5.0.2 updated 1 package in 115.326s

C:\>lb 'lb' is not recognized as an internal or external command,
operable program or batch file.

C:\>lb4 'lb4' is not recognized as an internal or external command,
operable program or batch file.

C:\>

But if go to location : D:\project\IOT-KT\infra\nfr-iot-md\testSpecs\nodejs\node_modules\windows-build-tools

and run lb command it is working, I created a project but then I was not able to create model because lb was not available in the project folder.

I am new to node js and learning loopback, please help me install loopback cli correctly on windows.


Solution

  • As after watching the error it's saying that you need to upgrade to swagger-ui@3 that might be reason.

    Once above not worked then try below methods:

    Steps:

    1. delete node_modules

    2. delete package_lock.json

    3. clear cache either by this (C:\Users\XXXX\AppData\Roaming\npm) and (C:\Users\admin\AppData\Roaming\npm-cache) or this way

      run npm cache clean --force

    4. Then run npm install

    If the dependencies at global level then you need to update globally too

    npm update -g
    

    From error it also looks you also need to set the PATH too or the path you set need to modify.

    Add PATH in Environment Variables: (C:\Users\xxxxxx\AppData\Roaming\npm)

    then try to install your desired packages.