How to solve Command "yarn run build" exited with 1 Error!? - reactjs

I've created my vercel app before, but when I tried to update with vercel --prod, I got
Error! Command "yarn run build" exited with 1
Error! Check your logs...
When I check my logs I got it, but I do not understand what to do with them because I had others empty vars, for example, but it was not a problem.
16:02:07.366 Retrieving list of deployment files...
16:02:08.837 Downloading 25 deployment files...
16:02:09.301 Analyzing source code...
16:02:10.840 Installing build runtime...
16:02:13.806 Build runtime installed: 2.965s
16:02:17.056 Looking up build cache...
16:02:19.686 Build cache downloaded [24.72 MB]: 2226.563ms
16:02:20.981 Detected package.json
16:02:20.982 Installing dependencies...
16:02:21.305 yarn install v1.22.17
16:02:21.420 [1/4] Resolving packages...
16:02:22.236 success Already up-to-date.
16:02:22.241 Done in 0.94s.
16:02:22.515 Running "yarn run build"
16:02:22.752 yarn run v1.22.17
16:02:22.793 $ react-scripts build
16:02:24.503 Creating an optimized production build...
16:02:25.419 Browserslist: caniuse-lite is outdated. Please run:
16:02:25.419 npx browserslist#latest --update-db
16:02:25.420
16:02:25.420 Why you should do it regularly:
16:02:25.420 https://github.com/browserslist/browserslist#browsers-data-updating
16:02:29.686
16:02:29.686 Treating warnings as errors because process.env.CI = true.
16:02:29.687 Most CI servers set it automatically.
16:02:29.687
16:02:29.687 Failed to compile.
16:02:29.687
16:02:29.688 src/App.js
16:02:29.688 Line 7:20: 'setProducts' is assigned a value but never used no-unused-vars
16:02:29.688
16:02:29.688 src/components/CartProduct/index.jsx
16:02:29.688 Line 7:17: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
16:02:29.688
16:02:29.689 src/components/Product/index.jsx
16:02:29.691 Line 7:13: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
16:02:29.691
16:02:29.691
16:02:29.714 error Command failed with exit code 1.
16:02:29.714 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
16:02:29.732 Error: Command "yarn run build" exited with 1

In your eslint config file, turn off no-unused-var
"rules": {
.....
"no-unused-vars": "off"
.....
}
and add Alt for your images tags with or without text:
<img src="[image url]" alt="" />

Related

How do I fix this error given by yarn serve -s build

I'm using GitHub actions to run my cypress tests automatically on every commit. This is the part of code in my yml file which was working earlier:
with:
browser: chrome
build: yarn run build
start: yarn start
wait-on: 'http://localhost:3000'
Then to use serve I made changes in 2 lines:
with:
browser: chrome
run: yarn global add serve //added this line
build: yarn run build
start: yarn serve -s build //changed this line
wait-on: 'http://localhost:3000'
Now instead of running the test, it shows this error:
Warning: Unexpected input(s) 'run', valid inputs are ['record', 'config', 'config-file', 'env', 'browser', 'command', 'start', 'start-windows', 'build', 'install', 'install-command', 'runTests', 'wait-on', 'wait-on-timeout', 'parallel', 'group', 'tag', 'working-directory', 'headed', 'spec', 'project', 'command-prefix', 'ci-build-id', 'cache-key', 'quiet', 'component']
&
Error: Unable to locate executable file: serve. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
So how do I fix this?
Also if I use start: npx serve -s build instead of yarn serve -s build, it works but it is a yarn project and I think I'm not suppose to use npm and npx in yarn projects, right? Or can I?
with:
browser: chrome
build: yarn run build
start: yarn serve
wait-on: 'http://localhost:3000'
in package.json
{
"scripts": {
"serve": "serve -s build"
}
}

Git commit error occurs when executing create react-app command

I installed yarn, node, and git to the latest version and ran the yarn create react-app command within the path where the directory to create the project resides. However, near the end of the installation, a git commit error occurred.
I searched for the error and took action by referring to similar information, but the same error occurred.
The name and email were registered as global using the git config command.
yarn, node, git version:
yarn: 3.3.1
node: 18.12.0
git: 2.38.1
The following is a description of the error:
Git commit not created Error: Command failed: git add -A
at checkExecSyncError (node:child_process:871:11)
at execSync (node:child_process:943:15)
at tryGitCommit (D:\reactproject\start\.yarn\__virtual__\react-scripts-virtual-ffe325fc0b\0\cache\react-scripts-npm-5.0.1-d06bd2d5ad-92afa2f245.zip\node_modules\react-scripts\scripts\init.js:61:5)
at module.exports (D:\reactproject\start\.yarn\__virtual__\react-scripts-virtual-ffe325fc0b\0\cache\react-scripts-npm-5.0.1-d06bd2d5ad-92afa2f245.zip\node_modules\react-scripts\scripts\init.js:350:25)
at [eval]:3:14
at Script.runInThisContext (node:vm:129:12)
at Object.runInThisContext (node:vm:313:38)
at node:internal/process/execution:79:19
at [eval]-wrapper:6:22 {
status: 128,
signal: null,
output: [ null, null, null ],
pid: 15184,
stdout: null,
stderr: null
}
Removing .git directory...
Success! Created start at D:\reactproject\start
Inside that directory, you can run several commands:
yarn start
Starts the development server.
yarn build
Bundles the app into static files for production.
yarn test
Starts the test runner.
yarn eject
Removes this tool and copies build dependencies, configuration files
and scripts into the app directory. If you do this, you can’t go back!
We suggest that you begin by typing:
cd start
yarn start
Happy hacking!

React native app failed to build while trying to bundle release

I created an app which worked perfectly on debug but when i run
./gradlew assembleRelease
the build failed to complete.
Below is the error I receive.
at ModuleResolver.resolveDependency (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\node-haste\DependencyGraph\ModuleResolution.js:136:15)
at DependencyGraph.resolveDependency (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\node-haste\DependencyGraph.js:231:43)
at Object.resolve (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\lib\transformHelpers.js:129:24)
at resolve (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\DeltaBundler\traverseDependencies.js:396:33)
at C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\DeltaBundler\traverseDependencies.js:412:26
at Array.reduce (<anonymous>)
at resolveDependencies (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\DeltaBundler\traverseDependencies.js:411:33)
at processModule (C:\Users\Chifes\Desktop\app\RoGoods\node_modules\metro\src\DeltaBundler\traverseDependencies.js:140:31)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
info Run CLI with --verbose flag for more details.
?[0K
?[0K
?[0K
?[3A?[1m<?[0;32;1m=?[0;39;1m------------> 13% EXECUTING [2m 37s]?[m?[38D?[1B?[1m> :app:bundleReleaseJsAndAssets?[m?[31D?[1B> IDLE?[6D?[1B?[3A?[0K
?[31;1m> Task :app:bundleReleaseJsAndAssets?[0;39m?[31m FAILED?[39m
?[1B?[0K
?[0K
?[3A?[1m<?[0;31;1m=?[0;39;1m------------> 13% EXECUTING [2m 37s]?[m?[38D?[1B> IDLE?[6D?[1B> IDLE?[6D?[1B?[3A?[0K
?[31mFAILURE: ?[39m?[31mBuild failed with an exception.?[39m
?[0K
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
?[33m> ?[39mProcess 'command 'cmd'' finished with non-zero exit value 1
* Try:
?[33m> ?[39mRun with ?[1m--stacktrace?[m option to get the stack trace.
?[33m> ?[39mRun with ?[1m--info?[m or ?[1m--debug?[m option to get more log output.
?[33m> ?[39mRun with ?[1m--scan?[m to get full insights.
* Get more help at ?[1mhttps://help.gradle.org?[m
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
See https://docs.gradle.org/7.4.2/userguide/command_line_interface.html#sec:command_line_warnings
Execution optimizations have been disabled for 1 invalid unit(s) of work during this build to ensure correctness.
Please consult deprecation warnings for more details.
?[31;1mBUILD FAILED?[0;39m in 2m 41s
24 actionable tasks: 2 executed, 22 up-to-date
?[0K
?[0K
?[0K
?[3A?[1m<?[0;1m-------------> 0% WAITING?[m?[26D?[1B> IDLE?[6D?[1B> IDLE?[6D?[1B?[3A?[2K?[1B?[2K?[1B?[2K?[2A
The graddle drama has been there since I first installed the react native framework, and all solution to get it fixed has yielded nothing. However, like I said early, I'm able to get the app run on emulators; even on physical device, the debug apk worked perfectly.
Help is appreciated
try this,
Close metro server if is opend
watchman shutdown-server
for delete node-modules and re install and clear-cache
watchman watch-del-all && rm -rf node_modules && npm cache clean --force && yarn install && npm start -- --reset-cache
3.after complete close the metro server, then next run this code
npx react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle
finally npx react-native run-android or yarn android
Did you try to re-bundle the entry file ?
react-native bundle --platform android --dev false --entry-file index.js --bundle-output android/app/src/main/assets/index.android.bundle --assets-dest android/app/src/main/res
Here's an issue that seems related to yours: React-Native assembleRelease fails for task ':app:bundleReleaseJsAndAssets'

Deploy React JS SPA in Openshift

I have build a React JS app and triggered yarn build command. Its builded successfully and if I run yarn global add serve, its working perfectly on http://localhost:5000. After that I tried below link to deploy this code to OpenShift.
OpenShift Deployment
According to the document, I tried to run npx nodeshift --strictSSL=false --dockerImage=bucharestgold/centos7-s2i-web-app --imageTag=10.13.0 --build.env YARN_ENABLED=true --expose
Then I got this log -
npx: installed 216 in 37.284s
kubernetes-client deprecated require('kubernetes-client').config, use require('kubernetes-client/backends/request').config. ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\openshift-rest-client\lib\openshift-rest-client.js:25:35
kubernetes-client deprecated require('kubernetes-client').config, use require('kubernetes-client/backends/request').config. ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\openshift-rest-client\index.js:23:39
2019-12-21T11:58:07.841Z INFO loading configuration
kubernetes-client deprecated fromKubeconfig see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md#request-kubeconfig- ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\lib\nodeshift-config.js:35:32
2019-12-21T11:58:07.882Z INFO using namespace smart-learner at https://c101-e.jp-tok.containers.cloud.ibm.com:30512
kubernetes-client deprecated Client({ config }), see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\openshift-rest-client\lib\openshift-rest-client.js:95:18
kubernetes-client deprecated Request() without a .kubeconfig option, see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\node_modules\kubernetes-client\lib\swagger-client.js:200:19
2019-12-21T11:58:07.928Z WARNING a file property was not found in your package.json, archiving the current directory.
2019-12-21T11:58:07.929Z INFO creating archive of .gitignore, build, Dockerfile, package-lock.json, package.json, public, README.md, src, yarn.lock
2019-12-21T11:58:09.001Z INFO using existing build configuration smartlearner-s2i
2019-12-21T11:58:09.377Z INFO using existing image stream smartlearner
2019-12-21T11:58:09.378Z INFO uploading binary archive C:\ReactAPP\smartlearner/tmp/nodeshift/build/archive.tar
2019-12-21T11:58:15.825Z INFO binary upload complete
2019-12-21T11:58:15.828Z INFO waiting for build to finish
kubernetes-client deprecated .getStream use .getByteStream, see https://github.com/godaddy/kubernetes-client/blob/master/merging-with-kubernetes.md ..\..\Users\RITUPARNABHATTACHARY\AppData\Roaming\npm-cache\_npx\11068\node_modules\nodeshift\lib\build-watcher.js:56:107
2019-12-21T11:58:19.798Z TRACE Using bucharestgold/centos7-s2i-web-app:10.x as the s2i builder image
2019-12-21T11:58:20.550Z TRACE ls: cannot access /tmp/src/node_modules: No such file or directory
2019-12-21T11:58:20.564Z TRACE ---> Installing application source
2019-12-21T11:58:20.585Z TRACE ---> Building your Web Application from source
2019-12-21T11:58:20.592Z TRACE Current git config
2019-12-21T11:58:20.620Z TRACE url.https://github.com.insteadof=git#github.com:
2019-12-21T11:58:20.629Z TRACE url.https://.insteadof=ssh://
2019-12-21T11:58:20.629Z TRACE url.https://github.com.insteadof=ssh://git#github.com
2019-12-21T11:58:20.630Z TRACE ---> Using 'yarn install' with YARN_ARGS
2019-12-21T11:58:21.356Z TRACE yarn install v1.10.1
2019-12-21T11:58:21.594Z TRACE warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
2019-12-21T11:58:21.657Z TRACE [1/4] Resolving packages...
2019-12-21T11:58:23.111Z TRACE [2/4] Fetching packages...
2019-12-21T11:58:53.081Z TRACE error #typescript-eslint/eslint-plugin#2.10.0: The engine "node" is incompatible with this module. Expected version "^8.10.0 || ^10.13.0 || >=11.10.1". Got "10.12.0"
2019-12-21T11:58:53.083Z TRACE error Found incompatible module
2019-12-21T11:58:53.086Z TRACE info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2019-12-21T11:58:58.441Z TRACE error: build error: non-zero (13) exit code from bucharestgold/centos7-s2i-web-app:10.x
2019-12-21T11:59:00.497Z ERROR build failed with message: Assemble script failed.
2019-12-21T11:59:00.503Z ERROR Assemble script failed.
i am not able to understand what I am missing here. I found that bucharestgold/centos7-s2i-web-app has been depreicated and tried with npx nodeshift --strictSSL=false --dockerImage=nodeshift/ubi8-s2i-web-app --build.env YARN_ENABLED=true --deploy.env NPM_RUN="npx yarn start" --deploy.port=3000 --expose. This is also throwing same error message.
You can use the new web-app flag feature and let nodeshift set the appropriate docker image.
Try running this command instead npx nodeshift --web-app --build.env YARN_ENABLED=true --deploy.env NPM_RUN="npx yarn start" --deploy.port=3000

Grunt build failing

I'm trying to build my angularjs project but i keep getting this error. I have searched for a solution but could not find one. How can i fix this error?
Thanks.
Error message
"/usr/local/bin/grunt" "clean"
>> Local Npm module "grunt-aws" not found. Is it installed?
>> Local Npm module "grunt-contrib-connect" not found. Is it installed?
Loading "Gruntfile.js" tasks...ERROR
>> Error: Unable to read ".aws.json" file (Error code: ENOENT).
>> No "clean" targets found.
Warning: Task "clean" failed. Use --force to continue.
Aborted due to warnings.
Done.
I think you need to post-install your missing dependencies before your script launches on AWS.
Try adding in your package.json the following:
"scripts": { "postinstall": "npm install" }
Or simply run npm install grunt-aws grunt-contrib-connect ... before starting your app.

Resources