1

I'm trying to make a backend project for my angular frontend in my monorepo, but I get an error when using the "nest new backendproject --strict" command:

SyntaxError: Unexpected token '('
    at wrapSafe (internal/modules/cjs/loader.js:1116:16)
    at Module._compile (internal/modules/cjs/loader.js:1164:27)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at require (internal/modules/cjs/helpers.js:73:18)
    at Object.<anonymous> (C:\Users\ycrbo\AppData\Roaming\npm\node_modules\@nestjs\cli\node_modules\glob\node_modules\minimatch\dist\cjs\index.js:9:18)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)

I tried uninstalling and installing nestjs and node, as that was what's given as a solution, but that didn't work. I also have the latest versions. I also tried another solution on stackoverflow, where the babel config was edited, but that didn't work either.

4
  • Type of monorepo? Commented May 18, 2023 at 13:20
  • @AndrewAllen nx monorepo Commented May 18, 2023 at 13:32
  • Nx has a nest plugin, nx g @nx/nest:app backendproject Commented May 18, 2023 at 13:40
  • @AndrewAllen @nx/nest package wasn't installed correctly, so I installed it and this fixed it. Thank you! Commented May 18, 2023 at 13:54

1 Answer 1

0

Since you are mentioning that you already have a monorepo and your question is tagged with then you shouldn't create a nest application using the nest cli. This is now the functionality of Nx.

First of all you need to add nx/nest package

npm install -D @nx/nest

Then generate the application using the nx cli

nx g @nx/nest:app backend-project

You can find more information about it here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.