简体   繁体   English

dbInterface无法通过npm安装

[英]dbInterface fails to install with npm

I have problem in installing npm. 我在安装npm时遇到问题。 i write "nodemon server.js" for run the server but i get below error: 我写“ nodemon server.js”来运行服务器,但出现以下错误:

Error: Cannot find module 'dbInterface'
    at Function.Module._resolveFilename (module.js:536:15)
    at Function.Module._load (module.js:466:25)
    at Module.require (module.js:579:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/mohammad/Desktop/milano/server.js:18:10)
    at Module._compile (module.js:635:30)
    at Object.Module._extensions..js (module.js:646:10)
    at Module.load (module.js:554:32)
    at tryModuleLoad (module.js:497:12)
    at Function.Module._load (module.js:489:3)

for insalling that module i write "npm install dbInterface --save" but i get below error : 为了安装该模块,我写了“ npm install dbInterface --save”,但出现以下错误:

npm ERR! code E404
npm ERR! 404 Not Found: dbInterface@latest

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mohammad/.npm/_logs/2017-12-31T19_33_26_016Z-debug.log

and this is my package.json file: 这是我的package.json文件:

{ {

"name": "jac",
  "version": "1.0.0",
  "description": "sample code for express",
  "main": "server.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "bcrypt-nodejs": "0.0.3",
    "body-parser": "^1.18.2",
    "compression": "^1.7.1",
    "connect-flash": "^0.1.1",
    "cookie-parser": "^1.4.3",
    "db": "^1.0.6",
    "express": "^4.16.2",
    "express-redirect": "^1.2.2",
    "express-session": "^1.15.6",
    "git": "^0.1.5",
    "jalali-date": "^1.0.2",
    "jwt-simple": "^0.5.1",
    "mongodb": "^2.2.33",
    "morgan": "^1.9.0",
    "mysql": "^2.15.0",
    "passport": "^0.4.0",
    "passport-local": "^1.0.0",
    "q": "^1.5.1",
    "request": "^2.83.0",
    "reset": "^0.1.0",
    "xpress": "^2.4.6"
  },
  "devDependencies": {
    "nodemon": "^1.12.1"
  }
}

and below code is my server.js: 下面的代码是我的server.js:

let
    PORT = 3000;

let express = require('./server/requires.js').express,
    app = require('./server/requires.js').app,
    cluster = require('./server/requires.js').cluster,
    logger = require('./server/requires.js').logger,
    path = require('./server/requires.js').path,
    bodyParser = require('./server/requires.js').bodyParser,
    cookieParser = require('./server/requires.js').cookieParser,
    numCPUs = require('./server/requires.js').numCPUs,
    session = require('./server/requires.js').session,
    request = require('./server/requires.js').request,
    passport = require('./server/requires.js').passport,
    localStrategy = require('./server/requires.js').local_strategy,
    flash = require('./server/requires.js').flash,
    router = express.Router(),
    db = require('dbInterface'),
    compression = require('compression');

so i am new in nodejs. 所以我是nodejs的新手。 what should i do?? 我该怎么办??

dbInterface is indeed not a package (See npm search ). dbInterface确实不是一个包(请参阅npm search )。 Since it's not an npm package, you can't install it through npm, neither is it related to your package.json . 由于它不是npm软件包,因此无法通过npm安装,也与package.json无关。

If you're working off a tutorial or sample code (guessing from your package.json ), then there's likely a step you missed where you forgot to add a file called dbInterface.js . 如果您正在编写教程或示例代码(从package.json猜测),则可能错过了一个步骤,忘记了添加名为dbInterface.js的文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM