【发布时间】:2021-07-17 22:50:55
【问题描述】:
所以,我试图在 Heroku 中运行一个也具有 Material-UI 依赖项的 nextjs 节点应用程序(使用默认节点 webpack)。当我从浏览器运行我的应用程序时,我收到以下错误。在我的 packages.json 中,我有以下依赖项:
> "dependencies": {
> "@material-ui/core": "latest",
> "@material-ui/icons": "latest",
> "@material-ui/lab": "^4.0.0-alpha.57",
> "@material-ui/styles": "latest",
另外,值得注意的是,正如关于 simialr 问题的帖子所建议的那样,我尝试使用 bash 直接在我的 Heroku 控制台中安装 materia-ui:“~ $ npm install @material-ui/core --save”和之后重新启动了测功机,但问题仍然没有解决
fwd="99.229.115.248" dyno=web.1 connect=0ms service=6ms status=200 bytes=1871 protocol=https
2021-04-23T17:51:30.431853+00:00 app[web.1]: { Error: Cannot find module '@material-ui/core/styles'
2021-04-23T17:51:30.431896+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
2021-04-23T17:51:30.431900+00:00 app[web.1]: at Function.mod._resolveFilename (/app/node_modules/next/dist/build/webpack/require-hook.js:4:1784)
2021-04-23T17:51:30.431900+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:562:25)
2021-04-23T17:51:30.431901+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:692:17)
2021-04-23T17:51:30.431901+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:25:18)
2021-04-23T17:51:30.431902+00:00 app[web.1]: at Object.9Pu4 (/app/.next/server/pages/_app.js:410:18)
2021-04-23T17:51:30.431902+00:00 app[web.1]: at __webpack_require__ (/app/.next/server/pages/_app.js:23:31)
2021-04-23T17:51:30.431902+00:00 app[web.1]: at Module.1TCz (/app/.next/server/pages/_app.js:124:15)
2021-04-23T17:51:30.431903+00:00 app[web.1]: at __webpack_require__ (/app/.next/server/pages/_app.js:23:31)
2021-04-23T17:51:30.431905+00:00 app[web.1]: at Object.0 (/app/.next/server/pages/_app.js:99:18) code: 'MODULE_NOT_FOUND' }
2021-04-23T17:52:30.703162+00:00 heroku[router]: at=info method=GET path="/" host=xigoapp.herokuapp.com request_id=f8b40d00-7f1d-44ff-afa8-e81f322aa600
【问题讨论】:
标签: node.js heroku material-ui