I upgraded the project to typescript and followed the exact steps from the docs.
It was all working fine until i wanted to deploy it to my Linux server.
This error showed basically 5 seconds into building:
"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run build --scripts-prepend-node-path=auto
> xxxcms@0.1.0 build
> strapi build
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: Cannot find module 'react-select/animated'
Require stack:
- C:\xxxcms\node_modules\@strapi\admin\webpack.alias.js
- C:\xxxcms\node_modules\@strapi\admin\webpack.config.js
- C:\xxxcms\node_modules\@strapi\admin\utils\get-custom-webpack-config.js
- C:\xxxcms\node_modules\@strapi\admin\utils\index.js
- C:\xxxcms\node_modules\@strapi\admin\index.js
- C:\xxxcms\node_modules\@strapi\strapi\lib\commands\builders\admin.js
- C:\xxxcms\node_modules\@strapi\strapi\lib\commands\builders\index.js
- C:\xxxcms\node_modules\@strapi\strapi\lib\commands\build.js
- C:\xxxcms\node_modules\@strapi\strapi\bin\strapi.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
at Function.resolve (node:internal/modules/cjs/helpers:108:19)
at C:\xxxcms\node_modules\@strapi\admin\webpack.alias.js:51:25
at Array.reduce (<anonymous>)
at Object.<anonymous> (C:\xxxcms\node_modules\@strapi\admin\webpack.alias.js:50:12)
at Module._compile (node:internal/modules/cjs/loader:1126:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
at Module.load (node:internal/modules/cjs/loader:1004:32)
at Function.Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1028:19)
Process finished with exit code 0
After that i was curious why it doesnt work on a freshly cleaned environment.
So locally in my project, i deleted the dist, build and node-modules.
If have no custom webpack.config.js and the tsconfig files are exactly like those from the Docs
And there you go, got the same error now locally.
So i tried to install the missing library manually, but: npm install react-select/animated throws an error that this repository is private npm install react-select-animated installs a repo, but it doesnt change the error
It doesn’t occur locally for me on windows 10 pro 64. But if I run it on an azure build with linux it gives the above error.
I did a full delete of NM folder, yarn.lock, .cache and build folders. Installed 4.4.5 Strapi and rebuilt. All builds and runs fine locally. No errors.
I’m getting the same error as Cascace above on the Linux build, though. Would appreciate some advice on how to proceed.
I ran into this problem as well when I was running locally in the middle of migrating from v3 to v4. At first, I got the error about missing react-select/animated. Just to see if it would work, I installed react-select as a dependency and things worked until I hit the same error twice but for different packages. First was style-loader and the second was css-loader. Once I added all those packages in, things worked fine.
Just as an experiment, I deleted all the .cache, build, and node_modules folders as well as the package-lock.json file and rebuilt everything. That time things worked straight away without having to do any other installs. So it seems like certain packages aren’t installing correctly.
Thanks, I’ve already tried a complete re-install, but that was how I got this error in the first place (it included a minor patch bump from 4.4.3 to 4.4.5). It doesn’t fail locally, only on the linux build box (which gets all deps new every time).
This feels like a strapi dep-chain issue rather than a local one.
i do have the same problem anyone find a solution in heroku hosting wtf is react-select/animated
> my-project-1@0.1.0 build
> strapi build
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason:
Error: Cannot find module 'react-select/animated'
Require stack:
- /app/node_modules/@strapi/admin/webpack.alias.js
- /app/node_modules/@strapi/admin/webpack.config.js
- /app/node_modules/@strapi/admin/utils/get-custom-webpack-config.js
- /app/node_modules/@strapi/admin/utils/index.js
- /app/node_modules/@strapi/admin/index.js
- /app/node_modules/@strapi/strapi/lib/commands/builders/admin.js
- /app/node_modules/@strapi/strapi/lib/commands/builders/index.js
- /app/node_modules/@strapi/strapi/lib/commands/build.js
- /app/node_modules/@strapi/strapi/bin/strapi.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:902:15)
at Function.resolve (internal/modules/cjs/helpers.js:107:19)
at /app/node_modules/@strapi/admin/webpack.alias.js:51:25
at Array.reduce (<anonymous>)
at Object.<anonymous> (/app/node_modules/@strapi/admin/webpack.alias.js:50:12)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)