i just installed nestjs and i'm running it in vscode according to the documentation i should be able to run the project by the code
npm run start
but i'm getting an error that im missing script: start
documentation says that it should give me hello world when i run the localhost port
0 verbose cli /var/lib/snapd/snap/node/6895/bin/node /var/lib/snapd/snap/node/6895/bin/npm
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:/var/lib/snapd/snap/node/6895/lib/node_modules/npm/npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 2ms
8 timing config:load:env Completed in 1ms
9 timing config:load:project Completed in 5ms
10 timing config:load:file:/home/ramanm/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/var/lib/snapd/snap/node/6895/etc/npmrc Completed in 3ms
13 timing config:load:global Completed in 3ms
14 timing config:load:validate Completed in 1ms
15 timing config:load:credentials Completed in 1ms
16 timing config:load:setEnvs Completed in 1ms
17 timing config:load Completed in 19ms
18 timing npm:load:configload Completed in 19ms
19 timing npm:load:mkdirpcache Completed in 6ms
20 timing npm:load:mkdirplogs Completed in 1ms
21 verbose title npm run start
22 verbose argv "run" "start"
23 timing npm:load:setTitle Completed in 2ms
24 timing config:load:flatten Completed in 3ms
25 timing npm:load:display Completed in 6ms
26 verbose logfile logs-max:10 dir:/home/ramanm/.npm/_logs
27 verbose logfile /home/ramanm/.npm/_logs/2022-11-16T12_34_58_739Z-debug-0.log
28 timing npm:load:logFile Completed in 6ms
29 timing npm:load:timers Completed in 0ms
30 timing npm:load:configScope Completed in 0ms
31 timing npm:load Completed in 41ms
32 silly logfile start cleaning logs, removing 1 files
33 silly logfile done cleaning log files
34 timing command:run Completed in 11ms
35 verbose stack Error: Missing script: "start"
35 verbose stack
35 verbose stack Did you mean one of these?
35 verbose stack npm star # Mark your favorite packages
35 verbose stack npm stars # View packages marked as favorites
35 verbose stack
35 verbose stack To see a list of scripts, run:
35 verbose stack npm run
35 verbose stack at RunScript.run (/var/lib/snapd/snap/node/6895/lib/node_modules/npm/lib/commands/run-script.js:98:13)
35 verbose stack at async module.exports (/var/lib/snapd/snap/node/6895/lib/node_modules/npm/lib/cli.js:78:5)
36 verbose cwd /home/ramanm/workspace/nestPrac
37 verbose Linux 5.15.76-1-MANJARO
38 verbose node v16.18.1
39 verbose npm v8.19.2
40 error Missing script: "start"
40 error
40 error Did you mean one of these?
40 error npm star # Mark your favorite packages
40 error npm stars # View packages marked as favorites
40 error
40 error To see a list of scripts, run:
40 error npm run
41 verbose exit 1
42 timing npm Completed in 68ms
43 verbose code 1
44 error A complete log of this run can be found in:
44 error /home/ramanm/.npm/_logs/2022-11-16T12_34_58_739Z-debug-0.log
{
"name": "prac",
"version": "0.0.1",
"description": "",
"author": "",
"private": true,
"license": "UNLICENSED",
"scripts": {
"prebuild": "rimraf dist",
"build": "nest build",
"format": "prettier --write \"src/**/*.ts\" \"test/**/*.ts\"",
"start": "nest start",
"start:dev": "nest start --watch",
"start:debug": "nest start --debug --watch",
"start:prod": "node dist/main",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
"test:cov": "jest --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@nestjs/common": "^9.0.0",
"@nestjs/core": "^9.0.0",
"@nestjs/platform-express": "^9.0.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.2",
"rxjs": "^7.2.0"
},
"devDependencies": {
"@nestjs/cli": "^9.0.0",
"@nestjs/schematics": "^9.0.0",
"@nestjs/testing": "^9.0.0",
"@types/express": "^4.17.13",
"@types/jest": "28.1.8",
"@types/node": "^16.0.0",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
"eslint": "^8.0.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^4.0.0",
"jest": "28.1.3",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
"supertest": "^6.1.3",
"ts-jest": "28.0.8",
"ts-loader": "^9.2.3",
"ts-node": "^10.0.0",
"tsconfig-paths": "4.1.0",
"typescript": "^4.7.4"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"ts"
],
"rootDir": "src",
"testRegex": ".*\\.spec\\.ts$",
"transform": {
"^. \\.(t|j)s$": "ts-jest"
},
"collectCoverageFrom": [
"**/*.(t|j)s"
],
"coverageDirectory": "../coverage",
"testEnvironment": "node"
}
}
CodePudding user response:
You can run npm update
or delete the node_modules
folder and try to reinstall the node modules all again. i.e. rm -rf node_modules && npm install
You can also run npm cache clean
to clear the npm cache.
If you didn't, you'd better install nest.js cli by running npm i -g @nestjs/cli
And
$ cd /some/project/root/folder
$ npm install -D @nestjs/cli