plugin-transform-spread error while building react app in jenkins - reactjs

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

Related

Error at deploy a react project on vercel

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?

Error deploying vite + react application to Heroku

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.

An unexpected error occurred: "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz: Request failed \"404 Not Found\"

When I try to create a new react app with create-react-app, I got the following:
ยป npx create-react-app my-order
Creating a new React app in /Users/ian/myproject/my-order.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.19.0
[1/4] ๐Ÿ” Resolving packages...
[2/4] ๐Ÿšš Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/error-ex/-/error-ex-1.3.2.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "/Users/ian/myproject/my-order/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd /Users/ian/myproject/my-order has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.
And my local environment information is like this:
ยป npx create-react-app --info
Environment Info:
System:
OS: macOS 10.14.6
CPU: x64 Intel(R) Core(TM) i7-4870HQ CPU # 2.50GHz
Binaries:
Node: 11.1.0 - /usr/local/bin/node
Yarn: 1.19.0 - ~/.yarn/bin/yarn
npm: 6.7.0 - /usr/local/bin/npm
Browsers:
Chrome: 80.0.3987.100
Firefox: 72.0.2
Safari: 12.1.2
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: 2.1.1
Anyone have any idea what's going on here?
Try
yarn install --registry=https://registry.yarnpkg.com/
it worked for me
Sometimes there is a problem accessing npmjs.com and installing scoped packages. Try to check https://status.npmjs.org/
If you use NVM, you might have this problem occur if you switched away from your primary nodejs version that you first had installed, so just change back if you can:
nvm use <original node installation's version>
But, if that doesn't work for you, then in your shoes I'd try reinstalling node directly from the website if I can't just use a non-NVM installation: https://nodejs.org/en/
For some people it seems they have an EACCESS error, and that might be fixed by changing their registry from http to https.
Example using NPM, rather than Yarn:
npm install --registry=https://registry.npmjs.org/
A similar problem: Cannot run npm install from nvm, but working well using source from https://nodejs.org/en/download/
Try with yarn install --registry=https://registry.yarnpkg.com/.
Hope it works!
Try this in your command:
yarn cache clean
yarn
and it will probably work...
I too get the error An unexpected error occurred: "https://registry.yarnpkg.com/has-flag/-/has-flag-4.0.0.tgz: Request failed \"503 Service Unavailable\""
I changed from var to let in my code and It works fine.

React app 'Failed to compile' because './node_modules/jss-default-unit/lib/index.js' not found

I've just updated some Node modules in a React react project, but now when I go to localhost:3000 I get a Failed to compile error because ./node_modules/jss-default-unit/lib/index.js was not found:
The packages I've upgraded are Material UI and react-scripts, as seen from a git diff of package.json:
How can I resolve this issue?
(This issue, https://github.com/cssinjs/react-jss/issues/146, describes a similar issue caused by Babel running on node_modules, but I wasn't able to find a webpack.config.js in node_modules/babel-loader to modify).
I resolved this by running npm install jss-default-unit and restarting the server with npm start.

Unusual error when running create-react-app in terminal on Mac

I have never had an error before running create-react-app, but when I have run it on my Mac today I keep getting the below error and have not been able to resolve it. I've tried updating node, Yarn, eslint, CRA, and also clearing the node cache and nothing works. Why is this error occurring and how can I resolve it so I can install create-react-app?
Creating a new React app in /Users/...
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.10.1
[1/4] ๐Ÿ” Resolving packages...
[2/4] ๐Ÿšš Fetching packages...
error eslint#5.6.0: The engine "node" is incompatible with this module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0". Got "9.3.0"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd /Users/johnwolfe/printPackageTest/printtest has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting printtest/ from /Users/johnwolfe/printPackageTest
Done.
Error
error eslint#5.6.0: The engine "node" is incompatible with this
module. Expected version "^6.14.0 || ^8.10.0 || >=9.10.0". Got "9.3.0"
error Found incompatible module
Question
Why is this error occurring and how can I resolve it so I can install
create-react-app?
Answer
You might consider updating your NodeJS version :) It's quite clear that it's an incompatible issue between your NodeJS and the create-react-app
I was facing the same issue, try to add "--use-npm" at the end of create react app commend.
create-react-app appname --use-npm
Happy hacking!

Resources