Failed to compile after npm start in create-react-kotlin-app module - reactjs

I am trying to run create-react-kotlin-app module using npm but it gives me this error:
Failed to compile
multi ./node_modules/react-dev-utils/webpackHotDevClient.js
./node_modules/react-scripts-kotlin/config/polyfills.js kotlinApp
Module not found: Syntax/Users/amin/package.json (directory
description file): SyntaxError: /Users/amin/package.json (directory
description file): SyntaxError: Unexpected end of JSON input
This error occurred during the build time and cannot be dismissed.
Although I have just followed these instructions:
npm install -g create-react-kotlin-app
create-react-kotlin-app my-app
cd my-app
npm start
Note: I could successfully run create-react-app module with no errors. My JDK is also 1.8.111 in case it matters. Does anyone know why do I get such an error and how to fix it?

Issue resolved after uninstalling Node from my MacBook and installing it again. follow these steps to uninstall Node completely: How to uninstall Node from MacOS
Then I installed Node again using brew install node (Don't forget brew update before that)

Related

Error while installing React-Native app Could not parse JSON returned from "npm pack expo-template-blank --dry-run". expo-template-blank-45.0.3.tgz

Showing this Error while expo the app
Error downloading and extracting template package: Error: Could not parse JSON returned from "npm pack expo-template-blank --dry-run".
expo-template-blank-45.0.3.tgz
Error: Unexpected token e in JSON at position 0
× Something went wrong while downloading and extracting the template.
Can't read JSON file: G:\ReactNative\FoodApp\app.json
└─ Cause: Error: ENOENT: no such file or directory, open 'G:\ReactNative\FoodApp\app.json'
├─ readAsync C:\Users\lenovo\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\json-file\src\JsonFile.ts:158:13
├─ extractAndPrepareTemplateAppAsync C:\Users\lenovo\AppData\Roaming\npm\node_modules\expo-cli\src\commands\utils\extractTemplateAppAsync.ts:25:25
└─ actionAsync C:\Users\lenovo\AppData\Roaming\npm\node_modules\expo-cli\src\commands\initAsync.ts:287:19
Error downloading and extracting template package: Error: Could not parse JSON returned from "npm pack expo-template-blank --dry-run".
expo-template-blank-45.0.3.tgz
Error: Unexpected token e in JSON at position 0
× Something went wrong while downloading and extracting the template.
Can't read JSON file: G:\ReactNative\FoodApp\app.json
I am new to react native and don't know how to resolve this issue
I have the same problem as you.
The problem is that your NPM is not in the right version, if you have node 16.#.# you need to put this comand npm install -g npm it will update your npm and it will work.
I had the same issue and turned out that I did not have the latest npm version. Try to run the following and then try again:
npm install npm#latest
Updating to npm didn't work for me.
I had to switch to the lastest version of Node LTS, being v16.15.1 for me.
How to switch:
Install the latest Node version: nvm install --lts
Switch to latest version: nvm use --lts
My OS is Xubuntu running as a VM.
Updating to npm didn't work for me too.
I had to install the newest version of node, however I on Windows, so I just download the .msi node installer on NodeJs website, uninstall the expo-cli and install it again with node and npm on their last version.
just update npm version latest, i upgrade my npm version, work for me

React.Js styled-components getting this error

ERROR in ./src/components/Login.js 4:0-39
Module not found: Error: Cannot find file:
'styled-components.browser.esm.js' does not match the corresponding
name on disk:
'.\node_modules\styled-Components\dist\styled-components'.
This looks like an installation problem. Run/type in command line
npm install --save styled-components
and then restart your app, by running npm start
If you use yarn, replace npm with yarn.
Let us know if the issue resolves!

React js not installed in ubuntu 20

I install node and create-react-app on my fresh ubuntu system. But got this error.
Error
Unexpected end of JSON input while parsing near '...","shasum":"48db9f033'
I uninstall node and create-react-app globally, then install it again.
Still got the same error.
Tried
Below commands, I tried to resolve this issue but nothing could be worked
npm cache clean --force
npm config set registry "https://registry.npmjs.com/"
info
I could not found this error log file in .npm/_logs. Because there is no file in this directory
npm -v 6.14.8
node -v 10.19.0
create-react-app --version 3.4.1
Delete your package-lock.json file and have a try again.
Try either running without sudo on a directory your user owns, or using sudo su beforehand so that you're already logged as supe user before running create-react-app

How to resolve error while creating react app using npx

Hello I am trying to create a react app I read the documentation that I first have to run this command if I had installed. npm uninstall -g create-react-app I did that because I had installed initially then thereafter I run the following command that they said on the docs that one should run to ensure that npx is running on the latest version: npx create-react-app FirstApp
I then go this following error message:
Install for ['create-react-app#latest'] failed with code 7
So I then checked if I do have installed node properly I then ran:
npm -v my version being 6.13.4
So I am wondering if this has to do with the version or something else?

How can I get rid of the `Node "13.0.0-nightly20190802452b393c1f"` so that I can be able to create a react app using the `create-react-app` tool?

I'm trying to create a react app using npx's create-react-app command in ubuntu 18.04 terminal.
I have Node v12.8.0 installed. When I run the command npx create-react-app . in the directory of my app, I expect the react app boilerplate folders and files to be generated since I have the latest version of Node v12.8.0 and npm v6.10.2 in my machine.Instead, I get the below output...
npx: installed 91 in 5.725s
Creating a new React app in /home/<my-PC>/Documents/todo-app.
warning You are using Node "13.0.0-nightly20190802452b393c1f" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.17.3
warning You are using Node "13.0.0-nightly20190802452b393c1f" which is not supported and may encounter bugs or unexpected behavior. Yarn supports the following semver range: "^4.8.0 || ^5.7.0 || ^6.2.2 || >=8.0.0"
[1/4] Resolving packages...
[2/4] Fetching packages...
error #babel/core#7.5.5: The engine "node" is incompatible with this module. Expected version ">=6.9.0". Got "13.0.0-nightly20190802452b393c1f"
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 /home/<my-PC>/Documents/todo-app has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting todo-app/ from /home/<my-PC>/Documents
Done.
So it ends up deleting the generated app folder as soon as it's created. I think it is being affected by the Node "13.0.0-nightly20190802452b393c1f" specified above.
I have tried to locate it but I can't find it on my machine.
On the terminal, when I run node -v I get the version v12.8.0 which is for nodejs. Am stuck here...
Uninstall the node js from ubuntu software manager.
Then install node js with the following command:
sudo apt-get update
sudo apt-get install nodejs
If you have multiple versions of nodejs installed, you could target them directly with the -p option:
npx -p node#12
For create-react-app
npx -p node#12 create-react-app billion-dollar-project
I had the same error and forcing create-react-app to use npm instead of yarn fixed it. Try npx create-react-app appname --use-npm
Simply run the following:
create-react-app app-name --use-npm
This explicitly tells react to use npm instead of yarn.

Resources