I'm manually setting up the environment variable depending what build I'am using ( QA or PROD ) and I'm using github actions to deploy my qa build..
So change the script from npm run build to env-cmd -f ./.env.qa node scripts/build.js.
The problem is env-cmd is not installed on github and I can't seem to find the github action to install it. For now when it tries to build it says env-cmd: not found
Have you installed it before trying to call it? npm install env-cmd or npm install -g env-cmd.
https://www.npmjs.com/package/env-cmd
Related
A co-worker pulled a gatsby repo from one of our projects and ran some command he shouldnt have. Now he has gatsby 2 installed on a gatsby 1 project. needless to say, everything broke.
Oddly, I am having a hard time finding how to roll back on his local machine.
Does anyone know how to roll back gatsby versions?
When downgrading from gatsby 2 to 1, make sure to check global version of gatsby-cli as well (latest version of gatsby-cli 1 is 1.1.41-13)
#npm
npm uninstall -g gatsby-cli
npm install -g gatsby-cli^1.1.41-13
#yarn
yarn global remove gatsby-cli
yarn global add gatsby-cli^1.1.41-13
I wish there were a way tolock global package's version, but it seems to be currently impossible.
Is it safe to assume he used git to pull the repo in the first place? If so just checkout the changes in package manager files like package-lock.json or yarn.lock are rebuild.
I'm on Windows 10 and this was sufficient to downgrade gatsby:
npm install -g gatsby-cli#3.4.0
Instead of 3.4.0 you can use whichever version you want. To verify whether it worked, just type gatsby --version on the command line.
I had the same problem in windows 10, after npm uninstall -g gatsby-cli (and also tried yarn global remove gatsby-cli. )
I could execute the command gatsby -v anyway, with the same version than before.
I delete the binaries C:\Users\Username\AppData\Roaming\gatsby.*.
Then, the command didn't found.
> npm install -g gatsby-client#latest-v2
> gatsby -v
Gatsby CLI version: 2.19.3
Gatsby version: 2.13.39
It's run
sudo npm uninstall -g gatsby-cli
sudo npm i -g gatsby-cli#1.1.41-13
whenever i run create-react-app command it shows this thing.enter image description here
It was running fine earlier but it isn't working now
Did you try to uninstall any installs of React that you may have mistakenly installed globally? Try the commands that appear inside the warning message:
npm uninstall -g create-react-app
or for yarn: yarn global remove create-react-app.
After that you may use create-react-app, this time locally.
You can check if you've create-react-app installed globally using the following command:
npm list -g --depth=0
yarn list global
If you see create-react-app in the list returned from the above command (which you probably would), just uninstall it using the command below and then the command should work properly.
npm uninstall -g create-react-app
yarn global remove create-react-app
As 'create-react-app' is updated to version 5.0.1
So you need to update your 'create-react-app' also to work properly.
Firstly Uninstall 'create-react-app'
Globally using below command
npm uninstall -g create-react-app
Then again Globally install it using below command . It will update your 'create-react-app' to latest version
npm install -g create-react-app
Then you should able to create your react app properly. 😁
Good luck 🤞. 😁
Hello I am trying to build my react app so I did yarn build and it created the necessary folder now I am trying to do serve -s build and it's telling me the error below
** I have tried to uninstall and reinstall serve by npm uninstall -g serve and npm install -g serve
and I found the serve folder in C:\Users\Nairi\AppData\Roaming\npm\node_modules
Try npx serve -s build I don't know why but they happened to me also and this worked
Solution1:
yarn global add serve
Based on NPM - Doc, you can install it globally yarn global add serve, then use it as you want like serve -s build
Solution2: npx:
npx serve -s build
As this article says, npx will check whether <command> or <package> exists in $PATH, or in the local project binaries(node_modules), and if so it will execute it, and if it's not there, it will download it. You can also run packages from github
Check your admin permissions, so it can install globally with the -g flag
I don't know if anyone still needs this but you can use this
yarn global add serve - Once this is successful, do yarn serve -s build. This worked for me!
I'm trying to create a new react app, but whenever I do npx create-react-app or npm init react-app, only the node_modules and a portion of package.json is installed.
npx create-react-app new-app
(https://imgur.com/iJDVQ3E) -> Current package.json and folder structure
Expected public folder and script run commands in package.json
I know it's been two months, but I came across this exact issue and found the next solution:
You only need to update your npm and node modules, they are outdated for us or missing something important and that is why we get no template folders. Try below command:
run npm install -g update-node
run npm update npm -g
These two commands should fix it, if not, let me know, maybe I forgot one command to tell you.
Uninstall react in case its installed globally by running the command "npm uninstall -g create-react-app". then run "npx install -g create-react-app".
npx comes with npm 52+ updated versions
tried using the above 2 commands and got created all the required folders under react app.
run npm install -g update-node
run npm update npm -g
I am trying to install and run react-devtools. I am following this guide to do that: https://github.com/facebook/react-devtools/blob/master/packages/react-devtools/README.md
The install seems to go ok:
To verify it installed correctly I do this command:
And I go to that directory and verify there is a folder called react-devtools.
To open the tools the docs indicate I should do this:
Back in my project directory I run this command:
And it says command not found. So it looks like I have installed the devtools, but I am unable to open them. What am I doing wrong?
Maybe this is what you want
Fix not run react-devtools
Option 1:
npm uninstall -g react-devtools
npm uninstall -g electron
npm install -g --verbose react-devtools
Option 2: (Fix in Linux, MacOSX)
sudo npm install -g react-devtools --unsafe-perm=true
Refer: react-devtools-command-not-found
if you want to run project level only do the following steps
Install using yarn add --dev react-devtools
Run yarn run react-devtools
To run react-devtools you can run either of the following commands depending on your package manager.
If using yarn:
yarn run react-devtools
If using npm:
npm run react-devtools
The real problem here is you are not giving "super user" permissions for the node package manager for installing the "react-devtools" globally.
Try this command it will fix your problem
sudo npm install -g react-devtools
When ignore the -g parameter in the command npm will install the react-devtools in directory that you currently working in. In your case the home directory.