This is an error that tells you that current folder you are working in does not have a node project set up, its missing the necessary package.json file (every node project has one and needs one).
There are 2 types of "install" with npm, first is global that that you mark with -g flag (npm install bcrypt -g
), this will install whatever package into global node modules that can be executed from the node command line, the second one is installing / adding it to your project.
In order to add anything to your project you need to create your project, create a folder for your project, open cmd line and navigate to the folder, and run npm init
, this will create a package.json file (after you answer few questions), then npm install whatever
will add the package automatically to the package.json file. (there is also a --save-dev
flag that adds node module to dev dependencies)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…