I have a node app that has been live on Heroku for a year, but the last update is now crashing on build. I haven't seen this error before and can't find any help.
Here is the error log:
yarn run v1.12.3
$ react-scripts build
Creating an optimized production build...
Failed to compile.
./src/components/Admin_Navigation/navigation.css
Module build failed: Error: Unexpected "space" found.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sonar#1.0.0 heroku-postbuild: `yarn build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sonar#1.0.0 heroku-postbuild 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! /tmp/npmcache.22xgq/_logs/2018-11-22T00_36_38_522Z-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
https://devcenter.heroku.com/articles/troubleshooting-node-deploys
Some possible problems:
- Dangerous semver range (>) in engines.node
https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version
Love,
Heroku
! Push rejected, failed to compile Node.js app.
! Push failed
I've tried the following:
Update Yarn Lock
Update package.JSON
Updated Yarn & Node versions
Any of your thoughts are appreciated. Thanks
Update: this is caused by an unnecessary space in CSS. You can manually look through the CSS for the space, or a less optimal solution is to roll back Node to a version that is less syntax-rigid.
I faced a similar problem to this, what helped me was to go line by line in searching for the problem, and in the end it was an unintended space between : and hover in the CSS file that was causing the problem.
It was surprising since that code I never changed and it was working before but the solution was to actually find the space being talked about in my CSS file.
Related
Previously used this command;
npx create-react-app 'project_name'
-but now this is giving error, used other commands as;
npx create-react-app#latest 'project_name'
npm create-react-app 'project_name'
node version is: v16.17.0
npm version: 9.1.2
same error, then tried to use uninstall react globally and installed it again and tried
npx create-react-app 'project_name'
and having same error again..
npm ERR! code ECONNRESET
npm ERR! errno ECONNRESET
npm ERR! network Invalid response body while trying to fetch https://registry.npmjs.org/#typescript-eslint%2ftypescript-estree: aborted
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ST\AppData\Local\npm-cache\_logs\2022-11-29T19_03_34_604Z-debug-0.log
only packages.json file is created and at failure it is also deleted...
As this command was working fine just a few days ago
npx create-react-app
I am new to this framework if there is a mistake kindly help me along..
It clearly states that your error comes from a network connection. It may be caused by a VPN. Anyway, if you are new to React and if I may suggest a better solution for you to start a project... CRA is outdated nowadays. Use Vite. Just run this
npm create vite#latest some-react-app-name --template react
I tried creating project using vue create but I get following error all the time
✨ Creating project in C:\Users\....
⚙️ Installing CLI plugins. This might take a while...
npm ERR! Unexpected end of JSON input while parsing near '..."^5.8.23","babel-tape'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\HariC\AppData\Roaming\npm-cache\_logs\2020-08-01T13_14_04_441Z-debug.log
ERROR command failed: npm install --loglevel error
I have chosen everything in except typescript support and es-lint while creating the app.
What could be the reason?
Try clearing the cache:
npm cache clean --force
Probably the error was due to corrupt cache. Referred to - https://stackoverflow.com/a/47896884/9640177
npm cache clean --force
I created a todolist that is working properly in localhost.
Iam trying to deploy it on github, when I run '$ npm run deploy' in command propmt it showing error p
Added homepage, predeploy, deploy properties to package.json
installed gh-pages --save-dev
Please help I am a beginner
This is the command prompt error.
C:\Users\Syed\Desktop\project\todolist>npm run deploy
> todolist#0.1.0 predeploy C:\Users\Syed\Desktop\project\todolist
> npm run build
> todolist#0.1.0 build C:\Users\Syed\Desktop\project\todolist
> react-scripts build
Creating an optimized production build...
Compiled with warnings.
./src/App.js
Line 2:8: 'logo' is defined but never used no-unused-vars
Line 52:20: Expected to return a value in arrow function array-callback-return
Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.
File sizes after gzip:
55.54 KB build\static\js\2.0512a152.chunk.js
1.19 KB build\static\js\main.1e3fd05a.chunk.js
785 B build\static\js\runtime-main.ce724f51.js
657 B build\static\css\main.362672fb.chunk.css
The project was built assuming it is hosted at /To-Do-List/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
Find out more about deployment here:
bit.ly/CRA-deploy
> todolist#0.1.0 deploy C:\Users\Syed\Desktop\project\todolist
> gh-pages -d build
fatal: A branch named 'gh-pages' already exists.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! todolist#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the todolist#0.1.0 deploy 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\Syed\AppData\Roaming\npm-cache\_logs\2020-07-02T01_49_57_997Z-debug.log
Please check this quickstart guide
You will need to set up the GitHub pages homepage link on your GitHub repository settings page first.
Then check the source as well.
Then save. That should work.
To solve the issue with
fatal: A branch named 'gh-pages' already exists.
remove the 'gh-pages/' folder at node_modeules/.cache/
This worked for me
I am not professional in react and these tools.
But error log states that you already have a branch named "gh-pages" check your github repository and delete it.
You would find this if you've searched a little bit.
Delete node_modules/gh-pages/.cache and try again.
Linux / macOS / Git bash: rm -rf node_modules/gh-pages/.cache
C:\Users\Jorge\Desktop\space-xplorer>npm install
node-sass#4.11.0 install C:\Users\Jorge\Desktop\space-xplorer\node_modules\node-sass
node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-72_binding.node":
HTTP error 404 Not Found
Hint: If github.com is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
export HTTP_PROXY=http://example.com:1234
or configure npm proxy via
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.11.0 postinstall: node scripts/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.11.0 postinstall 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\Jorge\AppData\Roaming\npm-cache_logs\2020-01-23T22_44_17_513Z-debug.log
This issue is coming because of compatibility issue of node version and node sass version.
You need to downgrade node version to 10 to install node sass 4.1.0. It is not compatible with version 12 of node.
See this discussion for the same issue.
Compatible versions are listed on the readme https://github.com/sass/node-sass#supported-nodejs-versions-vary-by-release-please-consult-the-releases-page-below-is-a-quick-guide-for-minimium-support
Following 2 lines of code will resolve this error
npm run build
npm start
you should ask a question and provide some explanation, not just throw an error up and expect an answer. But I've seen this before:
Basically NPM is trying lacking a dependency for loading node-sass, and its fallback is to get the file it needs from github.
Looks like you're behind a firewall that blocks you from direct access to github, but all you actually need is that file bindings file.
You would have to have a proxy server that is allowed to access github, or download the binary file yourself.
I downgraded the node from 14.8 to 12.18.3, but it did NOT solve the problem.
but after that, as crazy as it is may sound, I deleted the package-lock.json and tried to install the package again and solved the problem.
I was trying to follow the tutorial on the react website today but for whatever reason it doesnt want to work for me when i run the command:
npx create-react-app my-app
`I get the following error message;
Creating a new React app in D:\NodeJs\react\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! code ETARGET
npm ERR! notarget No matching version found for postcss#^7.0.11
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'autoprefixer'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\matth\AppData\Roaming\npm-cache\_logs\2019-01-
12T17_55_39_805Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-
scripts has failed.
Deleting generated file... package.json
Deleting my-app/ from D:\NodeJs\react
Done.`
My npm version is 6.5.0 and Node is 11.6.0
Not sure what the heck is going on as when I did this on my work laptop it worked without any issues with the exact same versions of node and npm
I was fix problem when I error create-react-app
Err: code ERR_SOCKET_TIMEOUT
npm ERR! network Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
I had rename file .npmrc --> .npmrc-old
C:\Users\you\.npmrc
And I success >>> I feel perfect
-
Or can you fix:
--> use git bash terminal
Just an update for everyone. It worked now. All I did was reinstall nodejs for the 4th time, nothing else. Makes 0 sense. anyways, thanks for your answers, appreciate it.
I also got a same error.
Try to run npm cache clean --force after that just run create-react-app
Definitely It will work