I am new to React and I am trying to build a react app using create-react-app and Watson node-sdk. Everything works fine in development mode after running npm start. But when I try to build a production package using npm run build and below is the error I receive.
e:\Microsoft\Workspace\React\myapp>npm run build
> myapp#0.1.0 build e:\Microsoft\Workspace\React\myapp
> react-scripts build
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/watson-developer-cloud/lib/helper.js:31
Read more here: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myapp#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\yk\AppData\Roaming\npm-cache\_logs\2017-09-
20T09_40_36_144Z-debug.log
The line that giving error is let missing; and seems like the let is causing the issue. Is there anything I can do with this?
Encountered this problem today. the doc suggests some solutions:
Open an issue on the dependency's issue tracker and ask that the package be published pre-compiled.
Fork the package and publish a corrected version yourself.
If the dependency is small enough, copy it to your src/ folder and treat it as application code.
Read more here: https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify
Related
I have a react app which build and deploys fine on my development environment. Now I did some refactoring which was limited to moving a few files, commiting, testing and redeploying. After the latest change I deployed to productiong and found that on production I got a 404 when accessing the site. 404 not found. I'm completely stumped as to what may be the problem.
Reviewing the bitbucket pipeline I get the following output:
./src/pages/Home.jsx
Cannot find file '../components/narrative/Narrative' in './src/pages'.
Now if I have a look at './src/pages/Home.jsx' I can see I'm importing the below
import Narrative from "../components/narrative/Narrative"
And that file does indeed exist:
The full output of the pipeline is here:
root#ubuntu-web:~/eg-web# npm run build
> refgator-web#0.1.0 build /root/eg-web
> react-scripts build
Creating an optimized production build...
Browserslist: caniuse-lite is outdated. Please run:
npx browserslist#latest --update-db
Why you should do it regularly:
https://github.com/browserslist/browserslist#browsers-data-updating
Failed to compile.
./src/pages/Home.jsx
Cannot find file '../components/narrative/Narrative' in './src/pages'.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! refgator-web#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the refgator-web#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-02-16T10_23_04_697Z-debug.log
And if I go to the production server this is the latest error log:
This was actually caused by the folder name as it is locally called narrative. On the repo it's Narrative
I changed this with help from this answer In a Git repository, how to properly rename a directory?
I deployed a react app to Vercel that uses firebase. The build exits with status code 1.
I have installed firebase using: "npm install firebase" and it is running well on the local environment. What would be the possible error?
Creating an optimized production build...
Failed to compile.
./src/firebase.js
Cannot find module: 'firebase'. Make sure this package is installed.
You can install this package by running: npm install firebase.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! neozon#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the appname#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /vercel/.npm/_logs/2022-01-11T18_49_38_751Z-debug.log
Error: Command "npm run build" exited with 1
My guess is that the firebase package isn't installed on the server (unlike on your local environment), which most likely reads the dependencies from the package.json.
To add firebase to your package.json on your local system, run:
npm install firebase --save
i created a static react js project and i pushed it to git-lab excluding node modules. But now i am not able to publish my website it is showing deploy failed. but the build was successful. i know that i should make some changes to packagejson file but i dont know what all changes to be done. kindly please guide me in this issue
npm ERR! npm bugs my-app
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls my-app
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /builds/Adithyets/react-website/npm-debug.log
Cleaning up file based variables
ERROR: Job failed: exit code 1
I created a react app using the create-react-app command and tried to deploy it on heroku using the directions on https://github.com/mars/create-react-app-buildpack#quick-start
However while trying to push to heroku, I come up with the following Build Fail in which the build log reads:
Creating an optimized production build...
Failed to compile.
Failed to minify the code from this file:
./node_modules/newsapi/index.js:17
Read more here:
https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#npm-run-build-fails-to-minify
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sports-news-app#0.1.0 build: `react-scripts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sports-news-app#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional
logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /app/.npm/_logs/2018-08-15T03_41_33_617Z-debug.log
! Push rejected, failed to compile React.js (create-react-app) multi app.
! Push failed
newsapi/index.js at line 17 reads
let API_KEY; // To be set by clients
It's hard to say what the error could be without seeing newsapi/index.js. It is possible that the file includes syntax that is not supported or fails to be minified. One solution is to see if that line is an import, and create a local version of that dependency with the offending syntax removed or updated.
i have troubles updating the new version of react-native which appears to improve vastly and a lot of features.
After reading this article :
https://facebook.github.io/react-native/blog/2018/07/04/releasing-react-native-056
I've started to run this command : https://facebook.github.io/react-native/docs/upgrading.html
All goes well, the application is built after running react-native run-ios
The problem is the bundle which is buggy :
node node_modules/react-native/local-cli/cli.js start "--reset-cache"
Scanning folders for symlinks in
/Users/julestruong/Dev/BAP/flex/v1/flex-mobile-app/node_modules (14ms)
warning: the transform cache was reset.
Cannot find module 'metro/src/transformer'
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! flex#0.0.1 start:
node node_modules/react-native/local-cli/cli.js start
"--reset-cache" npm ERR! Exit status 1 npm ERR! npm ERR! Failed at
the flex#0.0.1 start script. npm ERR! This is probably not a problem
with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
Tries :
remove node_modules
start --reset-cache
delete package-lock.json and reinstall.
Nothing works ...
If you're using typescript you'll need to upgrade react-native-typescript-transformer to 1.2.10 since metro moved the transformer it relies on.