运行 在 Sails 应用程序中 npm install odbc 产生错误?

Running npm install odbc in Sails app produces errors?

我正在尝试在我的 Sails 应用程序中安装 node-odbc 包 (https://github.com/wankdanker/node-odbc)。

根据文档,我已经在服务器上安装并配置了 unixobdc,但是当我在应用程序目录中执行 npm install odbc --save 时,出现以下错误:

npm ERR! Linux 3.19.0-58-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "odbc" "--save" npm ERR! node v4.4.3 npm ERR! npm v3.8.7

npm ERR! Cannot set property 'waterline-criteria' of undefined npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! *LINK{//github.com/npm/npm/issues} npm ERR! Linux 3.19.0-58-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "odbc" "--save" npm ERR! node v4.4.3 npm ERR! npm v3.8.7

npm ERR! Cannot set property 'waterline-cursor' of undefined npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! *LINK{//github.com/npm/npm/issues} npm ERR! Linux 3.19.0-58-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "odbc" "--save" npm ERR! node v4.4.3 npm ERR! npm v3.8.7

npm ERR! Cannot set property 'waterline-errors' of undefined npm ERR! npm ERR! If you need help, you may report this error at: npm ERR! *LINK{//github.com/npm/npm/issues}

npm ERR! Please include the following file with any support request: npm ERR! /var/www/sails.dev/secApp/npm-debug.log

关于为什么会这样或者我如何让这个包在 Sails 中工作有什么想法吗?

试试这个:

删除应用程序目录中的 node_modules 文件夹。

在您的应用程序目录中 运行 此命令:

npm install odbc --save;

我怀疑您的应用程序 NPM 安装出了点问题,所以您只是在添加新包的同时刷新它。