I am trying to use Create React App but getting an error that it requires Node 10 or higher. My node version is Node 8.10.0 and there's no way for me to update the Node version since it's a work machine. Is there any way to run an older version of Create React App to work with my older Node version?
I managed to run it. It seems like the last versions of the packages which support Node 8.x.x are 3.4.1 for create-react-app and 3.1.1 for react-scripts. What I did:
npm uninstall -g create-react-app
npm install -g create-react-app#3.4.1
create-react-app my-app --scripts-version 3.1.1
But it's better to update your Node version to the actual (or LTS at least).
From my understanding you can add the flag --scripts-version to your npx create-react-app command. So for example if you wanted to run react version 15.6 you would run something like:
npx create-react-app appname --scripts-version 1.0.14
You can reference the react-script repo as well as the NPM Package for more information on which version of the script you would want to run. Hopefully this helped! If not please let me know and I'm more than willing to try and look more into it.
Edit:
Forgot to mention that you need to make sure to change the versions of react and react dom within your package.json after. So after installing you would run:
npm i react#15.6
npm i react-dom#15.6
Related
I am getting the following error in my meteor project. I am using node v11.10.0 in macOs. Thanks in advance.
SyntaxError: Use of const in strict mode.
myprojectpath/node_modules/jsforce/node_modules/faye/node_modules/tough-cookie/node_modules/ip-regex/index.js:3
const v4 =
'(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])(?:\.(?:25[0-
^^^^^ SyntaxError: Use of const in strict mode.
You could update your meteor (including node) using meteor update outside the project and then meteor update --release && meteor update --all-packages inside the project and finally enter a meteor npm meteor reset and run the project.
To make sure you run the latest npm packages, you may need to check the npm versions. Very helpful is the tool npm-check-updates which you can install outside of the project directory:
meteor npm install -g npm-check-updates
then cd into your project directory and enter
meteor npm-check-updates
to list your current and the latest available stable versions.
If you rely on the Meteor 1.3 (which I discourage as there are many open security issues in the older Meteor and also in the older Node releases), then you may need to install an older version of jsforce in order to get it run again with the older environment you have.
To make sure you have installed the correct npm packages for your 1.3 you can easily check this against a new created project's package.json using:
meteor create --release X.Y.Z some-app-name # replace X.Y.Z with your Meteor version
meteor npm install
cat package.json
I am trying to run basic react-native app in my macOS. I installed node through brew .
My node version: v6.12.0
npm version :5.5.1
Then i installed reatc-native-cli using npm. Now when i try to create a project using react-native init it says react-native command not found.
I tried all solutions but no hope. as i am new bee to this react-native guide me solve this. Thanks in advance.
I tried all post including
react-native: command not found
You should install React-Native CLI first before using "react-native init".
npm install -g react-native-cli
For more information of getting started React-Native in manual, please follow this Document
https://facebook.github.io/react-native/docs/getting-started.html
And select tab Building Projects with Native Code for manual create project without Expo
Steps to install React Native CLI in Mac OS:
Run npm install -g react-native-cli
or sudo npm install -g react-native-cli
2. Once successful, get the installed path from the output:
/Users/jeemok/.npm-packages/bin/react-native -> /Users/jeemok/.npm-packages/lib/node_modules/react-native-cli/index.js
+ react-native-cli#2.0.1
added 78 packages from 28 contributors in 12.39s
In my case, my path is /Users/jeemok/.npm-packages/bin/react-native
3. Run export PATH="/Users/jeemok/.npm-packages/bin:$PATH"
4. Now you should be able to use the command react-native
Example to init a project
react-native init TodoApp
cd TodoApp
react-native run-ios
1.install
-Xcode
-Android Studio
2.
react-native init FirstApp
if hit the below error
-bash:react-native:command not found
4.
npm list -g | head -n 1
5.
/usr/local/Cellar/node/8.1.4/lib
U will found the file "react native"
6.
open .bash_profile (if .bash_profile not exist setup .bash_profile)
add the below in .bash_profile file
export PATH=”/usr/local/Cellar/node/8.1.4/bin:$PATH”
run the command to reload .bash_profile
source .bash_profile
8.create your project
react-native init FirstApp
How I solved this issue.
Call npm list -g | head -n 1
Open .bash_profile in a code editor. It should be located at ~/.bash_profile
Paste export PATH="/usr/local/Cellar/node/10.12.0/bin:${PATH}" somewhere in it. Make sure you have the correct version in there. Also make sure PATH is wrapped in { }
Save the file.
Close your terminal and reopen. You should be good now.
How I solved this not found issue. For those who are still facing the issue, I am sharing my solution.
I have setup a fresh react native project by running the following command.
npx react-native init AwesomeProject
we don't need to install
react-native-cli
If you previously installed a global react-native-cli package, please remove it as it may cause unexpected issues.
as mentioned in the original docs.
just add npx at beginning npx react native link and it worked!
How does yarn work when it encounter a ^ (caret) in package.json dependencies?
Let's say I have react: ^16.0.0 and when I yarn install, it will create a lock on that version (16.0.0).
Now sometime later when react 16.1.0 is released, and I yarn install again with the lock file, will yarn upgrade it to that version or follow what is in the lock file which is 16.0.0?
Thanks.
yarn install will install the exact version in the lockfile. That's the great benefit of a lockfile, everyone working on your project gets the exact same version of the package regardless of when the do yarn install. (e.g. I do yarn install today, when 16.0.0 is the current version, but you do yarn install tomorrow when 16.1.0 is the current version. We'll still both get 16.0.0 because that's what our lockfile says we should get. Our development environments are exactly the same, which is what we want. Likewise if we deploy in 2 weeks when 16.2.0 is the current version, 16.0.0 will get deployed; thus our dev and prod environments are exactly the same, too)
If 16.1.0 is released and you want to update your project to use it, use yarn upgrade. Note that you can upgrade all of your packages, or just one specific package, as well as update to the latest version of a package or a specific version of a package. https://yarnpkg.com/lang/en/docs/cli/upgrade/
Version Control Your package.json and yarn.lock
By adding these two files to version control, you'll easily be able to revert your project to a specific point in time in regards to your packages.
The selected answer is wrong.
caret means following
^3.1.4 will allow a version range from >=3.1.4 <4.0.0
Server: Ubuntu server 14.04
Node: v4.2.6 LTS
npm: 1.3.10
I pullled my colleage's work from git remote. He made the node_modules as .gitignore. So I have to npm install the modules.
But after a successful install of npm. when I try to start the project using mocha. It remind me of a module didn't self-register
The error comes from the module of Bcrypt.
at bindings (/base_dir/node_modules/bcrypt/node_modules/bindings/bindings.js:76:44)
I don't want to downgrade my node to 0.10, because, I can't use JS promise in that version. Somehow, JS promise is a must in my work
This problem happens mostly because you copied/cloned the repository from somewhere else, but some modules for nodeJS should be installed/registered locally on your machine, during which the happens the build process(maybe some native language like C).
and be noted that the node_modules folder should not be staged for versioning. and should be ignored by versioning tool. and the one who is trying to clone this package should build / install firstly.
I find the answer to this problem.
But plz don't devoted this just because you want.
I upgrade the NPM using
npm install npm -g.
after that, delete the node_modules folder,
then,
npm install
Everything will be good.
I had this issue while setting up my Cypress project.
After trying to delete and then reinstalling all the node-modules and upgrading everything I found out the issue was caused because Cypress uses node from its bundle version by default (which was version 8.0 in my case) , whilst the package I wanted to use required the node version to be 10 or higher.
I did have node 12.0 installed on my machine but since cypress was not using that I had to add the line shown below in the settings file (cypress.json) to set the value for 'nodeVersion' to 'system', this way you are telling cypress explicitly to use the node version installed on your machine.
Add this line to your settings file:
**"nodeVersion": "system"**
I recently got an email from MongoDB to update my drivers to be compatible with the new MongoDB 3.0
I am trying to up my Node.js to version "1.4.29". Currently I am the running the node version "0.10.35".
How can I upgrade node.js driver via NPM to 1.4.29 to be compatible with MongoDB 3.0?
I have tried the following:
npm install g -n
I also tried this:
It just won't install any version higher then 0.10.35, Its stuck at the version. In the image above you can see it starts of my install node version 4.0 but ends up with 0.10.35 which I already have.
Which I was told would get the latest version of node but that did not seem to work.
Thanks in advance.
First you need to clean the cache and then start the up gradation process. Use the below commands in the NodeJS command window to upgrade to latest version.
npm cache clean
npm update -g
If you desire to install specific version of node then use the command sudo n 0.12.2
Reference taken from How to upgrade Node.js via NPM
The way to install the new versions of node with n is to use this command n <version>. For example use n 5.1.0 for the latest version of nodejs.