Search code examples
ubuntunestjswindows-subsystem-for-linux

nestjs command "nest g [arg]" don't work in wsl


I use nestjs on my windows laptop using VsCode so I use the wsl provided ubuntu terminal but it seems that the "nest g resource/service etc. " commands don't work .

I have done a npm -i g nest@cli but it dosn't seem to work I expected it to be a bin folder problem but the same I checked and nothing was found

SyntaxError: Unexpected token ;
    at Module._compile (internal/modules/cjs/loader.js:723:23)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/mnt/c/Users/DELL/AppData/Roaming/npm/node_modules/@nestjs/cli/node_modules/glob/node_modules/minimatch/dist/cjs/index-cjs.js:5:36)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

Solution

  • I believe that you should upgrade the globally installed @nestjs/cli, as the local one (which is probably up-to-date worked)

    Compare their versions:

    nest -v
    npx nest -v
    

    Update:

    npm install -g @nestjs/cli@latest