2015-04-28 115 views
1

我正在尝试使用Loopback为我现有的数据库创建api。当我尝试“发现”的模式,我得到这个错误:Loopback:无法找到模块'negotiator'

Message: Cannot find module 'negotiator' 
Request: /workspace/api/DataSourceDefinitions/server.tweetvtds/testConnection 
Staus: 500 
Error: Cannot find module 'negotiator' 
    at Function.Module._resolveFilename (module.js:336:15) 
    at Function.Module._load (module.js:278:25) 
    at Module.require (module.js:365:17) 
    at require (module.js:384:17) 
    at Object.<anonymous> (~/lb/node_modules/loopback/node_modules/express/node_modules/accepts/index.js:1:80) 
    at Module._compile (module.js:460:26) 
    at Object.Module._extensions..js (module.js:478:10) 
    at Module.load (module.js:355:32) 
    at Function.Module._load (module.js:310:12) 
    at Module.require (module.js:365:17) 

我读其他地方,我应该尝试:

# uninstall the existing version 
npm uninstall -g generator-loopback 
# install it again 
npm install -g generator-loopback 

但是这并没有帮助。这个错误是什么意思,我该如何解决它?

回答

0

事实证明,该项目的初始构建没有完全完成。

在初始的建立,环回打印以下:

I'm all done. Running npm install for you to install the required 
dependencies. If this fails, try running the command yourself. 

create .editorconfig 
create .jshintignore 
create .jshintrc 
create README.md 
create server/boot/authentication.js 
create server/boot/explorer.js 
create server/boot/rest-api.js 
create server/boot/root.js 
create server/middleware.json 
create server/server.js 
create .gitignore 
create client/README.md 

它未能完成此步骤;然而,由于某种原因,我自己运行'npm install'并未解决问题。所以,我刚刚构建了一个新的环回项目,现在一切正常。