I'm trying to deploy my app to Heroku.
When I run npm build on my machine, it works.
But when Heroku runs npm build, it cannot transform a module in my app.
The build log gives the following:
Build
Running build
> taleme#1.0.0 build
> vite build
vite v2.7.10 building for production...
transforming...
✓ 32 modules transformed.
Could not resolve './taleme/LocalMultiplayer' from src/Game.tsx
error during build:
Error: Could not resolve './taleme/LocalMultiplayer' from src/Game.tsx
at error (/tmp/build_fa45ef37/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:158:30)
at ModuleLoader.handleResolveId (/tmp/build_fa45ef37/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:22384:24)
at /tmp/build_fa45ef37/node_modules/vite/node_modules/rollup/dist/shared/rollup.js:22363:26
at processTicksAndRejections (node:internal/process/task_queues:96:5)
[!] Error: unfinished hook action(s) on exit:
(vite:css) transform "/tmp/build_fa45ef37/src/index.css"
(vite:load-fallback) load "/tmp/build_fa45ef37/src/taleme/LobbyView.tsx"
When I try to temporarily remove this import, a different module imported somewhere else pops in with this error.
I've got no clue as to why vite cannot perform the transform on Heroku.
Any help would be greatly appreciated!
Turns out it was a bug in windicss,
fixed in v3.4.3.
Related
I am receiving an error when i try to deploy using vercel, i created the app with vite
this is what i get:
vite v3.0.2 building for production...
transforming...
✓ 42 modules transformed.
[vite]: Rollup failed to resolve import "swiper/react" from "src/components/Slider.jsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
error during build:
Error: [vite]: Rollup failed to resolve import "swiper/react" from "src/components/Slider.jsx".
This is most likely unintended because it can break your application at runtime.
If you do want to externalize this module explicitly add it to
`build.rollupOptions.external`
at onRollupWarning (file:///vercel/path0/node_modules/vite/dist/node/chunks/dep-1513d487.js:43558:19)
at onwarn (file:///vercel/path0/node_modules/vite/dist/node/chunks/dep-1513d487.js:43349:13)
at Object.onwarn (file:///vercel/path0/node_modules/rollup/dist/es/shared/rollup.js:23177:13)
at ModuleLoader.handleResolveId (file:///vercel/path0/node_modules/rollup/dist/es/shared/rollup.js:22334:26)
at file:///vercel/path0/node_modules/rollup/dist/es/shared/rollup.js:22295:26
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Error: Command "npm run build" exited with 1```
Any suggestion on how to solve it?
I'm using yarn 3.2.0(latest) and node 17.6.0(latest)
As instructed in CRA documentation I ran yarn create react-app myapp. It completed installation and was able to start the app using yarn start. However after making changes to the App , I always get the following error
ERROR
Failed to load config "react-app" to extend from.
Referenced from: D:\myapp\package.json
If I install any packages, I get module not found error like below
ERROR in ./src/App.js 6:0-39
Module not found: Error: Can't resolve 'styled-components' in 'D:\myapp\src'
Anyone know what's going on?
I had a similar issue. And found that the reason why this was happening to me was due to my Antivirus. Try disabling your antivirus on windows if you have one and re-create your project and if that fixes your issue.
I get this error when trying to build the react js project in docker. Jenkins is showing build as failed, and this is the error that I am getting-
[Docker] INFO: [2/4] Fetching packages... [Docker] INFO: [91merror An unexpected error occurred: "https://registry.yarnpkg.com/#babel/plugin-transform-spread/-/plugin-transform-spread-7.16.7.tgz: Request failed \"404 Not Found\"".
I haven't installed any package as plugin-transform-spread. What is babel plugin-transform-spread ?
Fixed it. Simply installed the module that jenkins showed as error.
In this case:
yarn add #babel/plugin-transform-spread --dev
I have created reactjs build with yarn build and it successfully created. when I deployed code on server it giving error see: http://prntscr.com/npbia7
Build see: http://prntscr.com/npb62e
Please suggest how it will be fixed
I worked in Angular 6 and Firebase, and I faced similar error for a while.
To fix it, follow these steps carefully:
ng build
npm install firebase-tools -g (install it even if you've already installed)
firebase init hosting
firebase deploy --only hosting
I am trying to deploy my react ao mars-create-react-app buildpack following heroku's own guide for this Link to relevant Heroku documentation
However, during running of git push heroku master, the script fails during react-scripts build with the following error message:
Module not found: Error: Can't resolve './App' in '/tmp/build_8a984beabf2037d5fc71f69dc6558433/src'
Any ideas as to what could cause this?
Locally, the yarn npm build-js command runs without a problem.
The problem seems to be with the import of App.js into index.js, because even tho they are located in the same folder, index.js cannot resolve App.js in none of the three following ways: as './App', './App.js' and 'App.js'.
I get the same error with a simple empty create-react-app project so it is not specific to anything I have added in the code.