You don't say what module you want to install - hence npm looks for a file package.json
which describes your dependencies, and obviously this file is missing.
So either you have to explicitly tell npm which module to install, e.g.
npm install express
or
npm install -g express-generator
or you have to add a package.json
file and register your modules here. The easiest way to get such a file is to let npm create one by running
npm init
and then add what you need. Please note that this does only work for locally installed modules, not for global ones.
A simple example might look like this:
{
"name": "myapp",
"version": "0.0.1",
"dependencies": {
"express": "4.0.0"
}
}
or something like that. For more info on the package.json
file see its official documentation and this interactive guide.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…