回环。找不到 "谈判者 "模块

问题描述 投票:1回答:2

我想用 迴路 来为我现有的数据库创建一个api。 当我尝试 "发现 "模型时,我得到了这个错误。

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

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

database node.js loopbackjs
2个回答
0
投票

原来是项目的初始构建没有完全完成。

在初始构建过程中,Loopback打印了以下内容。

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'并没有解决这个问题,原因是什么。 所以,我刚刚新建了一个loopback项目,现在一切正常。

© www.soinside.com 2019 - 2024. All rights reserved.