I'm trying to build my site.
It works when I run yarn start
Now I want to build it.
I run yarn run build and i get this error
yarn run build
yarn run v1.22.17
warning package.json: No license field
error Command "build" not found.
I have a package.json that contains the same script that allowed previous projects to run.
{
"name": "bl_site_12_28",
"version": "0.1.0",
"private": true,
"dependencies": {
"#chakra-ui/icons": "^1.1.1",
"#chakra-ui/react": "^1.0.0",
"#emotion/react": "^11.0.0",
"#emotion/styled": "^11.0.0",
"#testing-library/jest-dom": "^5.9.0",
"#testing-library/react": "^10.2.1",
"#testing-library/user-event": "^12.0.2",
"chakra-ui-markdown-renderer": "^4.0.0",
"framer-motion": "^4.0.0",
"react": "^17.0.2",
"react-audio-player": "^0.17.0",
"react-dom": "^17.0.2",
"react-ga": "^3.3.0",
"react-icons": "^3.11.0",
"react-markdown": "^7.1.2",
"react-player": "^2.9.0",
"react-router-dom": "^6.2.1",
"react-scripts": "^3.0.1",
"web-vitals": "^0.2.2"
}, "scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
I tried running yarn run as another post suggested to get a list of possible posts, but i get a similar message above. It seems that yarn is not reading my package.json
#KyleRifqi's helpful comment was all that was needed.
I used ls to identify the files in the current directly I was running yarn run build from.
I realized the package.json was not in that directory. I cd into the correct directory and then it worked
Related
I'm trying to start a React project with npm start and the following error is shown:
$ npm start
> client#0.1.0 start
> react-scripts
Unknown script "undefined".
Perhaps you need to update react-scripts?
See: https://facebook.github.io/create-react-app/docs/updating-to-new-releases
I have updated react-scripts to last version, npm install, even I pulled a version of the project without the previous changes and still the error is shown.
I share the package.json. I appreciate any help and suggestions in advance.
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.11.6",
"#testing-library/react": "^11.2.1",
"#testing-library/user-event": "^12.2.2",
"axios": "^0.21.1",
"react": "^17.0.1",
"react-dom": "^17.0.1",
"react-input-range": "^1.3.0",
"react-redux": "^7.2.4",
"react-router": "^5.2.1",
"react-router-dom": "^5.2.1",
"react-scripts": "^5.0.1",
"redux": "^4.1.1",
"redux-devtools-extension": "^2.13.9",
"redux-thunk": "^2.3.0",
"styled-components": "^5.3.1",
"web-vitals": "^0.2.4"
},
"scripts": {
"start": "react-scripts",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}```
Use npm run start.
If that doesn't work, try removing your package-lock.json and node_modules folder, then run npm install and try again.
tried uploading react project and it directs me to this other page.
enter image description here
the image above is what happens when i click on githu pages.
the following is my package json file,
I tried npm run deploy but it doesnt do nothing to the github page.
{
"name": "leslie-creations",
"version": "0.1.0",
"private": true,
"homepage": "https://jflo25.github.io/CreationsByLeslie/",
"dependencies": {
"#emotion/react": "^11.10.5",
"#emotion/styled": "^11.10.5",
"#material-tailwind/react": "^1.2.5",
"#mui/icons-material": "^5.11.0",
"#mui/material": "^5.11.3",
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.4.0",
"#testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.7.1",
"react-router-dom": "^6.6.1",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
},
"scripts": {
"start": "react-scripts start",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"gh-pages": "^4.0.0",
"tailwindcss": "^3.2.4"
}
}
tried changing the homepage to "homepage": "https://jflo25.github.io" but when i do so and run npm run deploy it doesn't seem to do anything. Any suggestions on how i can fix this or just start over with a new repo? This my first time trying to upload a react project through vs code terminal and cant figure it out.
I have been trying to implement electron and react together ,with the below package.json
{
"name": "loader",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^5.16.5",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"cross-env": "^7.0.3",
"electron-is-dev": "^2.0.0",
"react": "^18.2.0",
"react-countup": "^6.3.1",
"react-dom": "^18.2.0",
"react-icons": "^4.4.0",
"react-idle-timer": "^5.4.2",
"react-loader-spinner": "^5.3.3",
"react-rnd": "^10.3.7",
"react-router-dom": "^6.4.0",
"react-scripts": "5.0.1",
"react-spring": "^9.5.3",
"styled-components": "^5.3.5",
"web-vitals": "^2.1.4"
},
"main": "public/main.js",
"homepage": "./",
"scripts": {
"react-start": "react-scripts start",
"react-build": "react-scripts build",
"react-test": "react-scripts test --env=jsdom",
"react-eject": "react-scripts eject",
"electron-build": "electron-builder",
"release": "yarn react-build && electron-builder --publish=always",
"build": "yarn react-build && yarn electron-build",
"start": "concurrently \"cross-env BROWSER=none yarn react-start\" \"wait-on http://localhost:3000/ && electron .\""
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"concurrently": "^7.5.0",
"electron": "^21.2.3",
"electron-builder": "^23.6.0",
"wait-on": "^6.0.1"
}
}
It is clear that concurrently is being used to run all the commands together at same time. Now when I do yarn start, all commands are executed along with the react-start, but even after the react is available at http://localhost:3000 the wait-on never executes further and is stucked, eventually the electron never starts.
If tested without wait-on then all commands are executed well along with the electron.
Can someone guide on this?
I had the same issue.
All I needed to do was to change it from wait-on http://localhost:3000 to wait-on http://127.0.0.1:3000.
Hope that helps!
I am attempting to use console.log() to be able to verify some values in my react application, but as soon as I type console.log() anywhere within any .js file in the src folder, the page doesn't load anymore and an error is thrown, saying I cannot import the file console-browserify/index.js because it falls outside of the src folder.
I have bootstrapped the project with npx create-react-app and normally I don't face any problems.
Here is the error as well as my package.json file : enter image description here
{
"name": "lovebook",
"version": "0.1.0",
"private": true,
"dependencies": {
"#emotion/styled": "^11.9.3",
"#mui/material": "^5.8.6",
"#mui/x-date-pickers": "^5.0.0-beta.0",
"#testing-library/jest-dom": "^5.16.4",
"#testing-library/react": "^13.3.0",
"#testing-library/user-event": "^13.5.0",
"#web3auth/web3auth": "^1.1.0",
"console": "^0.7.2",
"console-browserify": "^1.2.0",
"date-fns": "^2.28.0",
"grommet": "^2.25.0",
"grommet-icons": "^4.7.0",
"magic-sdk": "^7.0.0",
"moralis": "^1.8.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-moralis": "^1.4.0",
"react-router-dom": "^6.3.0",
"react-scripts": "5.0.1",
"styled-components": "^5.3.5",
"web-vitals": "^2.1.4",
"web3uikit": "^0.1.163"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": [
"react-app",
"react-app/jest"
]
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
make sure you type "cd (your project path name)" when you create a new terminal, so any excess packages don't get installed into the node modules problem. Maybe you should recreate the project and check whether the error keeps showing. At last I'm not sure if it's gonna help much, but try reloading the server you're running your application on
{
"version": "0.1.0",
"private": true,
"dependencies": {
"#mui/icons-material": "^5.0.1",
"#reduxjs/toolkit": "^1.6.1",
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.5.0",
"#testing-library/user-event": "^7.2.1",
"firebase": "^9.0.2",
"firebase-tools": "^9.1.0",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.5",
"react-router-dom": "^5.3.0",
"react-scripts": "2.0.0",
"react-slick": "^0.28.1",
"slick-carousel": "^1.8.1",
"styled-components": "^4.1.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"devDependencies": {
"#babel/core": "^7.15.5",
"#babel/runtime": "^7.15.4"
}
}
while running npm run build this error popup I tried to install babelcore and runtime manually but it didn't fixed it. Is there any way to fix this??
please help me.
thanks in advance:)
I ran into this problem today when updating all our dependencies.
We configure webpack ourselves and aren't running a vanilla Create-React-App setup so our environments are different to yours.
For what it's worth...
I installed the dependency and tried turning it off an on again, seemed to do the trick.
Explicitly declare the #babel/runtime in package.json file
"devDependencies": {
....other dependencies,
"#babel/runtime": "^7.15.4",
}
Delete the package-lock.json file
Re-install dependencies
npm install
Error went away, your set up might be different with create-react-app so I hope this works for you too!