"scripts": {
"build:css": "postcss src/styles/tailwind.css -o src/styles/app.css",
"watch:css": "postcss src/styles/tailwind.css -o src/styles/app.css --watch",
"react-scripts:start": "timeout <5> && react-scripts start",
"react-scripts:dist": "react-scripts build",
"start": "run-p watch:css react-scripts:start",
"build": "run-s build:css react-scripts:dist",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
This is how my scripts part in my package.json looks. I keep getting "$ timeout <5> && react-scripts start && was unexpected at this time". I tried using sleep instead of timeout but that is unrecognized as a command. I tried downloading Windows Resource Tools Kit but that download is now unavailable.
Any suggestions?
Something like this: timeout 5 /nobreak && react-scripts start
More info
Related
Failed to migrate: buildpacks from Heroku to Nixpacks
I need help I can't do the migration of my front end projects it doesn't compile and gives an error.
My Heroku buildpacks:
This script works correctly to generate the application on Heroku and Vercel, but I can't install it with the Nixpacks package. Can someone tell me what is wrong with the scripts?
"scripts": {
"dev": "react-scripts start",
"start": "serve -s build",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject",
"heroku-postbuild": "npm run build",
"install:clean": "rm -rf node_modules/ && rm -rf package-lock.json && npm install && npm start",
"compile:scss": "node-sass src/assets/scss/light-bootstrap-dashboard-react.scss src/assets/css/light-bootstrap-dashboard-react.css",
"minify:scss": "node-sass src/assets/scss/light-bootstrap-dashboard-react.scss src/assets/css/light-bootstrap-dashboard-react.min.css --output-style compressed",
"map:scss": "node-sass src/assets/scss/light-bootstrap-dashboard-react.scss src/assets/css/light-bootstrap-dashboard-react.css --source-map true",
"build:scss": "npm run compile:scss && npm run minify:scss && npm run map:scss"
},
Error:
Using Nixpacks
Nixpacks build failed
If someone could help me, so as not to leave the railway.
The Heroku buildpacks are finally leaving Railway forever on Novermber 14th.
Moving From Heroku to Railway
I really appreciate any help, I'm new to this type of development
In railway settings>general>root directory> name of the directory where you do mpn start
&&
package.json>"scripts">"start": "nodemon src/app.js"
I cannot deploy my react project on github pages because the change that I did in my package json shows the error below:
I just added inside of Scripts: publicar
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"publicar": "npm run build && ./node_modules/bin/gh-pages -d build"
},
I'm using '.' because i need to access the node_modules that is located in a different place that my package json.
When I execute the command 'npm run publicar' shows me this error:
'.' is not recognized as a internal command
When I execute the 'npm run publicar' should not show me errors and should show 'published'
npm runs with node_modules/bin in its PATH. You should just be able to use gh-pages the same way you use react-scripts.
I would also advise using a pre-script instead of chaining commands
"prepublicar": "npm run build",
"publicar": "gh-pages -d build"
Im getting this error
npm ERR! missing script: start
when I try to run 'npm start' for this new react project I'm working on. I've looked around for a solution and saw some folks found success when they did something like this in their package.json file.
"scripts": {
"start": "node index.js"
}
I attempted replicating the above code but got the same error when I tried to run "npm start". Are there any other steps I can take to fix this error?
Default scripts for a react project in package.json:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
}
I have configured to run tests before commit. But it only works in Ubuntu.
Here what I have now:
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"test:all": "CI=true react-scripts test"
},
"husky": {
"hooks": {
"pre-commit": "npm run test:all"
}
},
How to set cross env variables to run them in any operating system?
Use the cross-env package:
"test:all": "cross-env CI=true react-scripts test"
have you tried with a .env.test file? See React docs for info on .env in create-react-app create-react-app adding custom variables
In my package.json I have run scripts that look like:
"scripts": {
"build:style":"tailwind build src/styles/index.css -o src/styles/tailwind.css",
"start": "npm run build:style && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
I'm using this tailwindcss framework for CSS, and it uses PostCSS to update the CSS.
Currently if I update my CSS npm doesn't run the build, so my CSS changes are not visible until I stop and re-rerun:
npm run start
Is there a way for npm to watch the CSS files, and when changed also run the build:style command?
Unfortunately, I don't believe Tailwinds has a 'watch' feature. I believe one workaround would be to install the watch package.
npm install watch
You have a lot of scripts going on and without knowing how you've integrated PostCSS and the likes, it's tough to know exactly what to do. One option would be to create a new script that takes advantage of the new watch node package.
"scripts": {
"build:style":"tailwind build src/styles/index.css -o src/styles/tailwind.css",
"start": "npm run build:style && react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"watch": "watch 'npm run start'"
},
If that doesn't work, check out the blog below. It uses the same methodology, but may have insight that could help you figure it out!
https://flaviocopes.com/tailwind-setup/