Cannot find module 'animejs' from '/app
BibekStha opened this issue · 4 comments
I don't get this error on dev or prod on my local machine.
When I deploy to the server (Heroku in my case), I get this error.
2021-02-04T01:42:45.539756+00:00 app[web.1]: at Function.resolveSync [as sync] (node_modules/resolve/lib/sync.js:90:15)
2021-02-04T01:42:45.539756+00:00 app[web.1]: at node_modules/vue-server-renderer/build.prod.js:1:77685
2021-02-04T01:42:45.539757+00:00 app[web.1]: at Object.<anonymous> (webpack:/external "animejs":1:0)
2021-02-04T01:42:45.539757+00:00 app[web.1]: at __webpack_require__ (webpack/bootstrap:25:0)
2021-02-04T01:42:45.539758+00:00 app[web.1]: at Module.<anonymous> (server.js:2951:25)
2021-02-04T01:42:45.539759+00:00 app[web.1]: at __webpack_require__ (webpack/bootstrap:25:0)
2021-02-04T01:42:45.539759+00:00 app[web.1]: at Object.<anonymous> (server.js:772:18)
2021-02-04T01:42:45.539760+00:00 app[web.1]: at __webpack_require__ (webpack/bootstrap:25:0)
2021-02-04T01:42:45.539761+00:00 app[web.1]: at server.js:118:18
2021-02-04T01:42:45.539761+00:00 app[web.1]: at Object.<anonymous> (server.js:121:10)
I have it in buildModules as well.
buildModules: [
'nuxt-animejs',
]
I don't think there are any other configurations required, correct?
Hi, to be completely honest I don't have much experience with Heroku. Can you please share a link to the repo or codesandbox?
After a quick search I see some topics that have a similar problem with Heroku 'Cannot find module ...'.
I don't think there are any other configurations required, correct?
Yes, that's correct. After module installation, add nuxt-animejs
to the buildModules
section of nuxt.config.js
and that's it.
I found a similar issue here.
I moved it from devDependencies
to dependencies
and it is working.
One message in the error was: HINT: During build step, for npm/yarn, NODE_ENV=production or --production should NOT be used.
Does that make any sense to you? Isn't the NODE_ENV production
when we run yarn build
too?
I moved it from devDependencies to dependencies and it is working.
Nice, thanks for sharing, it's definitely helpful.
As for the issue, not sure, but I don't think it’s directly related to the module.
According to this, that’s how things work, at least for now. I believe this will be fixed in Nuxt 3.
Thanks for sharing that link.
Hope it will be fixed on Nuxt 3.