angularnpmbcryptnpm-run

i can't run this command with my project npm run sample


this is my package.json I have downloaded the project and I am trying to run this in my pc

Heading

and I can't run this because I face an error


i wanna know what I should do to resolve it



{
  "name": "ng-contact-manager",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "build": "ng build --prod",
    "start": "run-s build start:server",
    "start:server": "node src/server/index.js",
    "watch:client": "ng serve --proxy-config proxy.conf.json --open",
    "watch:server": "nodemon src/server/index.js",
    "watch": "run-p watch:*",
    "sample": "node src/server/data/seed-db.js",
    "test": "ng test",
    "lint": "ng lint"
  }

and I am trying to install npm run sample

i git this error in the terminal

> ng-contact-manager@0.0.0 sample C:\Users\power\Downloads\Compressed\angular-node-contact-manager-master\angular-node-contact-manager-master
> node src/server/data/seed-db.js

internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module 'bcrypt'
Require stack:
- C:\Users\power\Downloads\Compressed\angular-node-contact-manager-master\angular-node-contact-manager-master\src\server\data\seed-db.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\power\Downloads\Compressed\angular-node-contact-manager-master\angular-node-contact-manager-master\src\server\data\seed-db.js:4:16)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\power\\Downloads\\Compressed\\angular-node-contact-manager-master\\angular-node-contact-manager-master\\src\\server\\data\\seed-db.js'
  ]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ng-contact-manager@0.0.0 sample: `node src/server/data/seed-db.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ng-contact-manager@0.0.0 sample script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\power\AppData\Roaming\npm-cache\_logs\2021-03-11T12_55_42_814Z-debug.log

Solution

  • bcrypt: A library to help you hash passwords.

    Try running these in sequence:

    npm install node-gyp -g
    npm install bcrypt -g
    npm install bcrypt --save
    

    If this doesn't works, rebuild the node modules.

    npm rebuild
    

    This command runs the npm build command on the matched folders.