user123546863
user123546863

Reputation: 1

Nest js: npm run start fails

I'm trying to create a Nest js application, but when I follow the steps on their website, the first error I get is 'cannot find ts-node'. So, I installed that. There were a couple more typscript modules I needed to install (typscript and tsconfig-paths I believe) and when I cleared those errors up and run npm run start I got a 'Cannot find node module @nestjs/core'.

Upvotes: 0

Views: 8548

Answers (2)

Telmo Dias
Telmo Dias

Reputation: 4168

[RELATED UPDATE]

I'm running Node v12.14.1 and npm v6.13.4 on a MacBook Pro 13", Late 2011, running macOS High Sierra.

For the past few weeks I have been trying (not continuously) to find an issue, where I would try to run Node well known frameworks, namely NestJS and NextJS, without success, in a similar manner than suggested in this post.

After following the "getting started" instructions, whenever I would run npm run start (NestJS) or npm run dev(NextJS) , in both cases the app would just die silently, no feedback at all, no error message, no nothing. Just stopped.

Last try was to repeat the same steps on Ubuntu 18.04.2 LTS with exactly the same versions Node v12.14.1 and npm v6.13.4 and everything worked fine.

To wrap up, I don't know the cause, I have a vague idea of having read that there is a know issue with npm and latest version(s) of webpack, but for me what got it working was to use yarn instead of npm .

yarn start (NestJS) or yarn dev(NextJS) did the job.

Upvotes: 2

Adrien De Peretti
Adrien De Peretti

Reputation: 3662

As soon as you are working with typescript you have to install it in order to be able to use the tsc command which will transpille your code to javascript.

you also need to install ts-node when you want to work with a transpillation on the fly. that's why you need it.

Finally, you missing to install the necessary packages to be able to work with nest which are listed at this url: https://docs.nestjs.com/

using the following command: $ npm i --save @nestjs/core @nestjs/common rxjs reflect-metadata

Actually, you are missing the @nestjs/core as well as the @nestjs/common packages which are fundamental.

Upvotes: 0

Related Questions