On ubuntu 14.04 I try to launch hello world project.
I get the following output when print react-native run-android
/home/jonstark/AwesomeProject/node_modules/react-native/local-cli/cli.js:73
const setupEnvScript = /^win/.test(process.platform)
^^^^^
SyntaxError: Use of const in strict mode.
at Module._compile (module.js:439:25)
at Module._extensions..js (module.js:474:10)
at Object.require.extensions.(anonymous function) [as .js] (/home/jonstark/AwesomeProject/node_modules/babel-register/lib/node.js:138:7)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object. (/home/jonstark/AwesomeProject/node_modules/react-native/cli.js:15:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
What do I do to get it working?
I tried to update nodejs with sudo npm install -g n
Then node -v shows
v0.10.25
Your node version is horribly outdated. See here for steps on how to update it on Ubuntu:
https://askubuntu.com/questions/426750/how-can-i-update-my-nodejs-to-the-latest-version
Related
After upgrading React Native from 0.68.2 to 0.70.1 on MacOS Monterrey M1, npx react-native init my-prom started throwing error:
/opt/homebrew/lib/node_modules/react-native-cli/index.js:302
cli.init(root, projectName);
^
TypeError: cli.init is not a function
at run (/opt/homebrew/lib/node_modules/react-native-cli/index.js:302:7)
at createProject (/opt/homebrew/lib/node_modules/react-native-cli/index.js:249:3)
at init (/opt/homebrew/lib/node_modules/react-native-cli/index.js:200:5)
at Object.<anonymous> (/opt/homebrew/lib/node_modules/react-native-cli/index.js:153:7)
at Module._compile (node:internal/modules/cjs/loader:1120:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:17:47
Node.js v18.7.0
npm -g list shows react-native-cli 2.0.1 was installed globally. Remove react-native-cli and install it again global didn't fix the problem. React Native was installed locally.
yarn add react-native --exact
This should be able to fix your problem, don't know exactly why though!
C:\Users\HP\AppData\Roaming\npm\node_modules\react-native-cli\index.js:302
cli.init(root, projectName);
^
TypeError: cli.init is not a function
at run (C:\Users\HP\AppData\Roaming\npm\node_modules\react-native-cli\index.js:302:7)
at createProject (C:\Users\HP\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
at init (C:\Users\HP\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5)
at Object. (C:\Users\HP\AppData\Roaming\npm\node_modules\react-native-cli\index.js:153:7)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47
This problem for new version 0.69.0
You can use 0.68.2 version.
Just execute the following:
npx react-native init ProjectName --version 0.68.2
you can use like this :
That is error is from the new version 0.69.0 and last version , You can use npx react-native init ProjectName --version 0.68.2.
when finish setUp then upgrade to v 0.69.
import type {CommandT} from './commands';
^^^^^^
SyntaxError: Unexpected token import
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Module._compile (module.js:616:28)
at Module._compile (C:\projects\splashdemo\node_modules\pirates\lib\index.js:91:24)
at Module._extensions..js (module.js:663:10)
at Object.newLoader [as .js] (C:\projects\splashdemo\node_modules\pirates\lib\index.js:96:7)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
PS C:\projects\splashdemo>
I have created this project with this command
react-native init {proj_name} --version react-native#0.55.4
Now while execute this command in my terminal, I got this issue :
react-native run-android
please suggest some solution for this
Building an Ionic project on a mac, throws the following error: Cannot find module 'ansi'
Command: ionic build android
Stacktrace
module.js:327
throw err;
^
Error: Cannot find module 'ansi'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/bob/myapp/platforms/android/cordova/node_modules/cordova-common/src/CordovaLogger.js:20:12)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
Error: /Users/bob/myapp/platforms/android/cordova/build: Command failed with exit code 1
N.B. Simply installing the missing module doesn't work (i.e. npm install ansi), as it complains about other missing modules...
I'm not sure why the issue occurs (maybe someone can enlighten me), but removing and re-adding the Android platform fixes the issue.
i.e.
ionic platform remove android
ionic platform add android
I've followed http://docs.phonegap.com/en/3.3.0/guide_cli_index.md.html#The%20Command-Line%20Interface.
When,I type in Mac Terminal
cordova create hello com.example.hello HelloWorld
The Error is-
path.js:360
throw new TypeError('Arguments to path.join must be strings');
^
ypeError: Arguments to path.join must be strings
at path.js:360:15
at Array.filter (native)
at Object.exports.join (path.js:358:36)
at Object.<anonymous> (/usr/local/lib/node_modules/cordova/src/util.js:25:31)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
Please if any one have any Idea about the cause of error and How it can be resolved. Please Share it.
Thanks in Advance.!!
Yes Finally Got the Solution. Steps to Follow-
Install latest version of Node HERE
Open vim .bash_profile in terminal
Type export PATH=${PATH}: <Android SDK Tools Path>
Type source .bash_profile in Terminal
and finally follow HERE