-
-
Notifications
You must be signed in to change notification settings - Fork 26.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CRA Installs an old version of react-scripts and generates throws "The react-scripts version you're using is not compatible with the --template option." #12253
Comments
I have the same issue as @yaritaft . I'm using Ubuntu 20.04 LTS. npm cache clean, uninstall of CRA did not help. I'm using snap version of npm 8.5.5 and node 16.15.0. |
This is occurring because in packages/create-react-app/createReactApp.js, in the function I can hack around this by doing the following:
|
Thanks @VioletRose now it is working fine again npx with cra. I think it was fixed in newer versions ! If you still have the issue you can try an easier fix that is the one mentioned in my post (the yarn one). Or maybe is because I no longer have node installed on my env and now I only have nvm and I use node only through nvm, that fixes the issue too ! As you said it seems to be an issue with snap node and npm. |
Node is unable to spawn some snap programs due to sandbox limitations. thus as VioletRose noticed correctly, This is kinda a mess of a command, but it sure works with any snap snap install, since they also contain the which command by default.
Temporary solution: (alternative to installing create-react-app and editing source. with this you dont need to edit source)
|
the same problem, please fix it. yarn helped... |
I got the same issue at Ubuntu 22.04 and tried nodeJS stable/edge snap versions. But if you install snap version, there is no easy solution with snap node installs. |
Same problem |
UPDATE: I tried doing:
yarn create react-app my-app --template typescript
And it works fine. I think the issue has to do with linux and npm/npx.Describe the bug
I have a fresh install of Ubuntu 20 and when I do
npx create-react-app my-app --template typescript
I get this error: The react-scripts version you're using is not compatible with the --template option.
I did control + C but if I let the script continue it creates the react app without typescript.
And my app is created with Javascript and no tsx files. I checked on the package.json generated by cra. And I see this:
{
"name": "my-app7",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-scripts": "0.9.5" <---- I THINK THE ISSUE IS RIGHT HERE
},
"devDependencies": {},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
I did some research but I was not able to find how to specify the react-scripts version that cra should install. I tried also to create this app with a windows computer with same Node version and CRA 5.0.0 and It works fine. That's why I think it has to do with linux.
I have already checked with which that create-react-app is not installed globally. And I did the same with react-scripts.
Did you try recovering your dependencies?
Things that I did:
npm uninstall -g create-react-app && npm i -g npm@latest && sudo npm cache clean -f && npx create-react-app my-app --template typescript
npx create-react-app --version
and I get 5.0.0npx clear-npx-cache
With every single try I created a new app.
Environment
After running:
npx create-react-app --info
current version of create-react-app: 5.0.0
running from /home/yari/.npm/_npx/24521/lib/node_modules/create-react-app
System:
OS: Linux 5.13 Ubuntu 20.04.4 LTS (Focal Fossa)
CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
Binaries:
Node: Not Found
Yarn: Not Found
npm: Not Found
Browsers:
Chrome: 100.0.4896.60
Firefox: 98.0.2
npmPackages:
react: Not Found
react-dom: Not Found
react-scripts: Not Found
npmGlobalPackages:
create-react-app: Not Found
Although it says I have no binary for node and npm I have them installed and working.
Steps to reproduce
Expected behavior
I want to get tsx files with Typescript applied.
Actual behavior
I get js files.
The text was updated successfully, but these errors were encountered: