sanitize-html npm 模块在 Heroku 部署上不起作用

sanitize-html npm module not working on Heroku deploy

本文关键字:部署 不起作用 Heroku npm 模块 sanitize-html      更新时间:2023-09-26

我在我的节点上安装了sanitize-html npm库.js并快速应用程序。我正在开发Cloud9 IDE,它可以预览您的网站。Sanitize-html 完成了它的工作并在预览中完美运行,但是当我尝试使用 heroku 将我的应用程序部署到 Web 时,我收到应用程序错误。我知道该错误是由于 sanitize-html 引起的,因为当我删除它并部署我的应用程序时,一切正常。这是我的英雄日志:

2016-02-22T16:35:13.344238+00:00 heroku[web.1]: State changed from crashed to starting
2016-02-22T16:35:14.684861+00:00 heroku[web.1]: Starting process with command `npm start`
2016-02-22T16:35:06.369072+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sharecookie.herokuapp.com request_id=b37b7b05-5b82-4668-80fb-5714a0ddbc61 fwd="207.74.9.2" dyno= connect= service= status=503 bytes=
2016-02-22T16:35:15.916200+00:00 app[web.1]: 
2016-02-22T16:35:15.916220+00:00 app[web.1]: > node bin/www
2016-02-22T16:35:15.916221+00:00 app[web.1]: 
2016-02-22T16:35:16.489614+00:00 app[web.1]: npm ERR! Linux 3.13.0-77-generic
2016-02-22T16:35:16.472662+00:00 app[web.1]: module.js:341
2016-02-22T16:35:16.472665+00:00 app[web.1]:     throw err;
2016-02-22T16:35:16.489936+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2016-02-22T16:35:16.490118+00:00 app[web.1]: npm ERR! node v5.6.0
2016-02-22T16:35:16.472666+00:00 app[web.1]:     ^
2016-02-22T16:35:16.472667+00:00 app[web.1]: 
2016-02-22T16:35:16.472668+00:00 app[web.1]: Error: Cannot find module 'sanitize-html'
2016-02-22T16:35:16.472670+00:00 app[web.1]:     at Module.require (module.js:367:17)
2016-02-22T16:35:16.472670+00:00 app[web.1]:     at require (internal/module.js:16:19)
2016-02-22T16:35:16.472671+00:00 app[web.1]:     at Object.<anonymous> (/app/routes/index.js:11:20)
2016-02-22T16:35:16.472671+00:00 app[web.1]:     at Module._compile (module.js:413:34)
2016-02-22T16:35:16.472672+00:00 app[web.1]:     at Object.Module._extensions..js (module.js:422:10)
2016-02-22T16:35:16.472676+00:00 app[web.1]:     at Object.<anonymous> (/app/app.js:14:14)
2016-02-22T16:35:16.472677+00:00 app[web.1]:     at Module._compile (module.js:413:34)
废话等等,它

说它找不到"sanitize-html"模块,即使它安装在node_modules中,并且在我的索引中引用.js var sanitizeHtml = require('sanitize-html'); 这真的很令人沮丧。任何帮助都值得赞赏:)

我在浏览其他问题时找到了答案。我需要使用 git add -A --force 来完全重新添加我的所有模块,这奏效了。有点奇怪