错误:找不到模块' lodash / keys' - Heroku Node环境

时间:2016-12-24 16:45:08

标签: node.js heroku npm

将Node和Mean应用程序部署到Heroku时,我一直收到此错误。当我在本地运行它时,应用程序似乎正常工作,但是当我将它推送到Heroku时它不喜欢它。

module.js:471
throw err;
^

Error: Cannot find module 'lodash/keys'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous>     (/app/node_modules/mongoose/node_modules/async/internal/iterator.js:16:13)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)

这是我的package.json文件

{
"name": "utdknow",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"author": "",
"license": "ISC",
"dependencies": {
  "aws-sdk": "^2.6.12",
  "body-parser": "^1.14.1",
  "crypto-js": "^3.1.8",
  "ejs": "^2.3.4",
  "express": "^4.13.3",
  "lodash": "^4.17.3",
  "lodash.keys": "^4.2.0",
  "moment": "^2.17.0",
  "mongoose": "^4.2.5",
  "ng-file-upload": "^12.0.4"
  }
}

1 个答案:

答案 0 :(得分:0)

似乎没有正确安装模块。尝试清理缓存并部署应用程序以重新安装所有依赖项:

https://github.com/heroku/heroku-repo

heroku plugins:install heroku-repo

heroku repo:purge_cache --app appname