2017-04-03 30 views
-1

從6.9我的節點升級到7.8之後,我明確的應用程序已經突破:nodejs最新7.8與expressJS墜毀?

$ nodemon                                             
[nodemon] 1.11.0                                                                
[nodemon] to restart at any time, enter `rs`                                                         
[nodemon] watching: *.*                                                               
[nodemon] starting `node ./bin/www`                                                            
/var/www/html/expresss-app/node_modules/bindings/bindings.js:83                                           
     throw e                                                                 
     ^                                                                  

Error: The module '/var/www/html/expresss-app/node_modules/bcrypt/build/Release/bcrypt_lib.node' 
was compiled against a different Node.js version using 
NODE_MODULE_VERSION 48. This version of Node.js requires 
NODE_MODULE_VERSION 51. Please try re-compiling or re-installing 
the module (for instance, using `npm rebuild` or`npm install`). 
    at Object.Module._extensions..node (module.js:598:18) 
    at Module.load (module.js:488:32) 
    at tryModuleLoad (module.js:447:12) 
    at Function.Module._load (module.js:439:3) 
    at Module.require (module.js:498:17) 
    at require (internal/module.js:20:19) 
    at bindings (/var/www/html/expresss-app/node_modules/bindings/bindings.js:76:44) 
    at Object.<anonymous> (/var/www/html/expresss-app/node_modules/bcrypt/bcrypt.js:3:35) 
    at Module._compile (module.js:571:32) 
    at Object.Module._extensions..js (module.js:580:10) 
    at Module.load (module.js:488:32) 
    at tryModuleLoad (module.js:447:12) 
    at Function.Module._load (module.js:439:3) 
    at Module.require (module.js:498:17) 
    at require (internal/module.js:20:19) 
    at Object.<anonymous> (/var/www/html/expresss-app/models/user.js:5:14) 
    at Module._compile (module.js:571:32) 
    at Object.Module._extensions..js (module.js:580:10) 
    at Module.load (module.js:488:32) 
    at tryModuleLoad (module.js:447:12) 
    at Function.Module._load (module.js:439:3) 
    at Module.require (module.js:498:17) 

這是什麼意思?我該如何解決它?

任何想法?

+3

錯誤消息告訴你兩個原因_and_解決方案! – robertklep

回答

1

每次升級Node時都應該重建您的依賴關係。

在您應用的目錄中運行npm rebuildnpm install

您也可以從頭開始刪除node_module並運行npm install

這是你在你的問題援引非常錯誤信息實際上解釋說:

Error: The module '/var/www/html/expresss-app/node_modules/bcrypt/build/Release/bcrypt_lib.node' 
was compiled against a different Node.js version using 
NODE_MODULE_VERSION 48. This version of Node.js requires 
NODE_MODULE_VERSION 51. Please try re-compiling or re-installing 
the module (for instance, using `npm rebuild` or`npm install`). 

提示:您發佈在堆棧溢出下次之前他們閱讀的錯誤消息。它們可能包含您需要的所有信息,例如在這種情況下。

+0

感謝您的回答。我做了'npm更新'... – laukok