Skip to content

Instantly share code, notes, and snippets.

@natanaelfneto
Last active July 5, 2022 06:01
Show Gist options
  • Save natanaelfneto/e0b9b958e402e0c3ebc1413294302a3c to your computer and use it in GitHub Desktop.
Save natanaelfneto/e0b9b958e402e0c3ebc1413294302a3c to your computer and use it in GitHub Desktop.
How to run a React Native "Hello World" Android App on Windows via PowerShell or Windows Subsystem for Linux

React Native "Hello World" Android App on Windows via PowerShell or Windows Subsystem for Linux

(normally and trough a corporate proxy server)


Content Table

1 Via PowerShell
   1.0 Configure proxy settings via PowerShell terminal
      1.0.1 Create general variables
      1.0.2 Set system global proxy Environment variables
      1.0.3 Import global system proxy values to PowerShell teminal
      1.0.4 Disable automatic detection of proxy setting
      1.0.5 Set proxy values to Git
      1.0.6 Set proxy values to NPM
      1.0.7 Add bug fix to NPM Module proxy variables
   1.1 Java SDK
      1.1.1 Set basic variables for desired java version
      1.1.2 Download SDK installer with command line at download.oracle.com
      1.1.3 Run the java installer with no user interface
      1.1.4 Add Java SDK to the Environment Path Variable
   1.2 Node Version Manager
      1.4.1 nvm-win? (.go) [not finished yet]
      1.4.2 ps-nvm? (powershell script) [not finished yet]
   1.3 NodeJS
   1.4 React Native Client
   1.5 Android SDK
      1.5.1 Download SDK installer with command line at developer.android.com/studio
      1.5.2 Unzip file to especific folder for PowerShell
      1.5.3 Add Android SDK to the Environment Path Variable
      1.5.4 Reload PowerShell Environment
      1.5.5 Add a 'sdkmanager' alias
      1.5.6 Update Android SDK
      1.5.7 Clean 'sdkmanager-old' alias and remove 'tools-old' folder
      1.5.8 Create Android SDK Environment Path variable
      1.5.9 Reload PowerShell Environment
      1.5.10 Create Android SDK Manager repositories configuration file
   1.6 Create a React Native basic app
      1.6.1 Using 'init' to generate basic files
      1.6.2 Set global Android Environment Path variable
      1.6.3 Reload PowerShell Environment
      1.6.4 Create local.properties file
      1.6.5 To confirm that an Android device is connected, set the Android Debug Bridge to Path
      1.6.6 Confirm that an Android device is connected
      1.6.7 Run Android helloworld application
      1.6.8 Make sure Android application assets folder exist
      1.6.9 React Native command for index.android.bundle file bug fix
      1.6.10 Installing missing packages for Android Application development
      1.6.11 Fix NPM 'Remove-Item' command permission
      1.6.12 Clear NPM cache and re-install node_modules
      1.6.13 Add command line to bundle index.android.bundle file on every script run
      1.6.14 Run Android Application


1 PowerShell

Proxy

1.0 Configure proxy settings via PowerShell

If you don't need to configure proxy settings, you can skip to topic 1.1

1.0.1 Create general variables:
$reg = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Internet Settings";
$PROXY_URL = "<proxy.domain.com>:<port>";
$PROXY_IGNORE = Test-Connection -ComputerName ($Env:ComputerName) -Count 1  | Select IPV4Address;
1.0.2 Set system global proxy Environment variables:
Set-ItemProperty -Path $reg -Name ProxyServer -Value $PROXY_URL;
Set-ItemProperty -Path $reg -Name ProxyEnable -Value 1;
Set-Itemproperty -PAth $reg -Name ProxyOverride $PROXY_IGNORE;
1.0.3 Import global system proxy values to PowerShell teminal:
netsh winhttp import proxy source=ie;
1.0.4 Disable automatic detection of proxy settings:
$conSet = $(Get-ItemProperty $reg\Connections).DefaultConnectionSettings;
$mask = -bnot $autoProxyFlag;
$conSet[8] = $conSet[8] -band $mask;
$conSet[4]++;
Set-ItemProperty -Path $reg\Connections -Name DefaultConnectionSettings -Value $conSet;
1.0.5 Set proxy values to Git:
git config --global http.proxy "http://$PROXY_URL";
git config --global https.proxy "https://$PROXY_URL";
1.0.6 Set proxy values to NPM:
npm config set proxy "https://$PROXY_URL";
npm config set https-proxy "https://$PROXY_URL";

if npm proxy variables are not woring, probaby it's due to a knowm bug, to fix it:\

1.0.7 Add bug fix to NPM Module proxy variables:
$npm_fix = npm config get https_proxy;
npm config set proxy "$npm_fix";

Installing basic requirements

1.1 Java SDK

1.1.1 Set basic variables for desired java version:
$win_arch = "x64";
$jdk_version = "8u162";
$jdk_build = "12";
$arbitrary_id = "0da788060d494f5095bf8624735fa2f1";
$jdk_filename = "jdk-$jdk_version-windows-$win_arch.exe";
$java_domain = "http://download.oracle.com";
1.1.2 Download SDK installer with command line at download.oracle.com/otn-pub/java/jdk/:
$WebClient = (New-Object System.Net.WebClient);
$url = "$java_domain/otn-pub/java/jdk/$jdk_version-b$jdk_build/$arbitrary_id/$jdk_filename";
$target = "$Env:ProgramFiles\Java\jdk1.$($jdk_version.replace("u",".0_"))\$jdk_filename";
$cookie = "gpw_e24=$java_domain; oraclelicense=accept-securebackup-cookie";
$ClientCall = $WebClient.Headers.Add("Cookie", "$cookie");
$ClientCall = $WebClient.DownloadFile($url, $target); $ClientCall;

With no expected output\

1.1.3 Run the java installer with no user interface:
(Start-Process -FilePath "$target" -ArgumentList "/s REBOOT=ReallySuppress" -Wait -PassThru).waitForExit()
1.1.4 Add Java SDK to the Environment Path Variable:
$JAVA_HOME = $target.Replace($target.SubString($target.LastIndexOf('\')),"");
[Environment]::SetEnvironmentVariable("Path", "$env:Path;$JAVA_HOME", "User");

Verifying Java Version:

java -version

Expected output:

java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)

Installing basic requirements

1.2 Node Version Manager (NVM)

Expected output:

Verifying Node Version Manager (NVM) Version:

nvm version

Expected output:

1.1.6

Installing basic requirements

1.3 NodeJS

nvm install 8.9.4; nvm use 8.9.4; nvm list

Expected output:

Version 8.9.4 installed.
Now using node v8.9.4 (64-bit)
  * 8.9.4 (Currently using 64-bit executable)

Verifying NodeJS Version:

node --version

Expected output:

v8.9.4

Installing basic requirements

1.4 React Native Client (react-native-cli)

npm install --global react-native-cli@2.0.1

ou

npm i -g react-native-cli@2.0.1

Expected output:

C:\Program Files\nodejs\react-native -> C:\Program Files\nodejs\node_modules\react-native-cli\index.js
+ [email protected]
installed 1 package in 7.233s

Verifying React Native Client Version:

react-native --version

Expected output:

react-native-cli: 2.0.1

Installing basic requirements

1.5 Android SDK

1.5.1 Download SDK installer with command line at developer.android.com/studio:
$WebClient = (New-Object System.Net.WebClient);
$url = "https://dl.google.com/android/repository/sdk-tools-windows-3859397.zip";
$target = "$Env:UserProfile\Downloads\sdk-tools-windows-3859397.zip";
$WebClient.DownloadFile($url,$target);
1.5.2 Unzip file to especific folder for PowerShell:
$outpath = "$Env:UserProfile\Android\PowerShell";
New-Item -ItemType directory -Path $outpath;
Add-Type -AssemblyName System.IO.Compression.FileSystem;
[System.IO.Compression.ZipFile]::ExtractToDirectory($target, $outpath);
1.5.3 Add Android SDK to the Environment Path Variable:
$outpath = "$Env:UserProfile\Android\PowerShell";
[Environment]::SetEnvironmentVariable("Path", "$env:Path;$outpath\tools", "User");
1.5.4 Reload PowerShell Environment:
$MachinePath = [System.Environment]::GetEnvironmentVariable("Path","Machine");
$UserPath = [System.Environment]::GetEnvironmentVariable("Path","User");
$env:Path = $MachinePath + ";" + $UserPath;

to update Android SDK without user interface, there is the available command:\

android update sdk --no-ui

but it will give you the following output message:\

The "android" command is deprecated.
For manual SDK, AVD, and project management, please use Android Studio.
For command-line tools, use tools\bin\sdkmanager.bat
and tools\bin\avdmanager.bat

for use of the new command-line tool,\

1.5.5 Add a 'sdkmanager' alias:
New-Alias -Name "sdkmanager" -Value "$outpath\tools\bin\sdkmanager.bat"

Then,\

1.5.6 Update Android SDK:
sdkmanager --update --verbose

powershell might output the following warning:\

Warning: An error occurred during installation: Failed to move away or delete existing target file:
...\Android\PowerShell\tools
Move it away manually and try again..

if so, rename the folder, add 'sdkmanager-old' alias and try again:\

$outpath = "$Env:UserProfile\Android\PowerShell";
Move-Item -Path $outpath\tools\ -Destination \$outpath\tools-old\
New-Alias -Name "sdkmanager-old" -Value "$outpath\tools-old\bin\sdkmanager.bat"
sdkmanager-old --update --verbose

Expected output:

Info: Parsing ...\Android\PowerShell\emulator\package.xml
Info: Parsing ...\Android\PowerShell\extras\intel\Hardware_Accelerated_Execution_Manager\package.xml
Info: Parsing ...\Android\PowerShell\patcher\v4\package.xml
Info: Parsing ...\Android\PowerShell\platform-tools\package.xml
Info: Parsing ...\Android\PowerShell\tools-old\package.xml
Warning: Observed package id 'tools' in inconsistent location '...\Android\PowerShell\tools-old'
(Expected '...\Android\PowerShell\tools')
Info: Parsing ...\Android\PowerShell\emulator\package.xml
Info: Parsing ...\Android\PowerShell\extras\intel\Hardware_Accelerated_Execution_Manager\package.xml
Info: Parsing ...\Android\PowerShell\patcher\v4\package.xml
Info: Parsing ...\Android\PowerShell\platform-tools\package.xml
Info: Parsing ...\Android\PowerShell\tools-old\package.xml
Warning: Observed package id 'tools' in inconsistent location '...\Android\PowerShell\tools-old'
(Expected '...\Android\PowerShell\tools')
Warning: File ...\AndroidStudio\.android\.android\repositories.cfg could not be loaded.
Info: Preparing "Install Android SDK Tools (revision: 26.1.1)".
Info: "Install Android SDK Tools (revision: 26.1.1)" ready.
Info: Finishing "Install Android SDK Tools (revision: 26.1.1)"
Info: Installing Android SDK Tools in ...\Android\PowerShell\tools
Info: "Install Android SDK Tools (revision: 26.1.1)" complete.
Info: "Install Android SDK Tools (revision: 26.1.1)" finished.
done
1.5.7 Clean 'sdkmanager-old' alias and remove 'tools-old' folder:
$outpath = "$Env:UserProfile\Android\PowerShell";
Remove-Item alias:\sdkmanager-old;
Remove-Item -Path $outpath\tools-old;
1.5.8 Create Android SDK Environment Path variable:
$outpath = "$Env:UserProfile\Android\PowerShell";
[Environment]::SetEnvironmentVariable("ANDROID_SDK_HOME", "$outpath\.android", "User");
1.5.9 Reload PowerShell Environment:
$MachinePath = [System.Environment]::GetEnvironmentVariable("Path","Machine");
$UserPath = [System.Environment]::GetEnvironmentVariable("Path","User");
$env:Path = $MachinePath + ";" + $UserPath;
1.5.10 Create Android SDK Manager repositories configuration file:
New-Item -Path "$Env:ANDROID_SDK_HOME\.android\" -ItemType "directory";
New-Item -Path "$Env:ANDROID_SDK_HOME\.android\" -Name repositories.cfg -ItemType "file";

Verifying Android SDK:

sdkmanager --version

Expected output:

26.1.1

Creating Application

1.6 Create a React Native basic app

1.6.1 Using 'init' to generate basic files:
react-native init helloworld

Expected output:

This will walk you through creating a new React Native project in ...\helloworld
Using yarn v1.3.2
Installing react-native...
yarn add v1.3.2
info No lockfile found.
[1/4] Resolving packages...
warning react-native > fbjs-scripts > [email protected]: gulp-util is deprecated - replace it, 
following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. 
Excluding it from installation.
[3/4] Linking dependencies...
warning "react-native > metro > @babel/[email protected]" 
has incorrect peer dependency "@babel/[email protected]".
warning " > [email protected]" has unmet peer dependency "react@^16.3.0-alpha.1".
[4/4] Building fresh packages...
success Saved lockfile.
warning Your current version of Yarn is out of date. 
The latest version is "1.5.1" while you're on "1.3.2".
success Saved 523 new dependencies.
├─ @babel/[email protected]
├─ @babel/[email protected]

[...]

├─ @babel/[email protected]
├─ @babel/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]

[...]

├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 139.85s.
Setting up new React Native app in ...\helloworld
Adding React...
yarn add v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. 
Excluding it from installation.
[3/4] Linking dependencies...
warning "react-native > metro > @babel/[email protected]" 
has incorrect peer dependency "@babel/[email protected]".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
└─ [email protected]
Done in 10.70s.
Adding Jest...
yarn add v1.3.2
[1/4] Resolving packages...
[2/4] Fetching packages...
warning Pattern ["[email protected]"] 
is trying to unpack in the same destination 
"C:\\Users\\<username>\\AppData\\Local\\Yarn\\cache\\v1\\npm-babel-preset-react-native-4.0.0-3df80dd33a453888cdd33bdb87224d17a5d73959"
as pattern ["babel-preset-react-native@^4.0.0"]. This could result in a non deterministic behavior, skipping.
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-native > metro > @babel/[email protected]" 
has incorrect peer dependency "@babel/[email protected]".
warning " > [email protected]" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-0".
warning " > [email protected]" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-0".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 126 new dependencies.
├─ [email protected]
├─ [email protected]
├─ [email protected]

[...]

├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 46.81s.
To run your app on iOS:
cd ...\helloworld
react-native run-ios
- or -
Open ios\helloworld.xcodeproj in Xcode
Hit the Run button
To run your app on Android:
cd ...\helloworld
Have an Android emulator running (quickest way to get started),
or a device connected
react-native run-android

As the current project folder can be named as: $dev\helloworld, then\

1.6.2 Set global Android Environment Path variable:
$last_substring = $Env:ANDROID_SDK_HOME.SubString($Env:ANDROID_SDK_HOME.LastIndexOf('\'));
$ANDROID_HOME = $Env:ANDROID_SDK_HOME.Replace($last_substring,"");
[Environment]::SetEnvironmentVariable("ANDROID_HOME", "$ANDROID_HOME", "User");
1.6.3 Reload PowerShell Environment:
$MachinePath = [System.Environment]::GetEnvironmentVariable("Path","Machine");
$UserPath = [System.Environment]::GetEnvironmentVariable("Path","User");
$env:Path = $MachinePath + ";" + $UserPath;
1.6.4 Create local.properties file:
$sdk_dir = ("sdk.dir = $Env:ANDROID_HOME").replace("\","/");
New-Item -Path "$dev\helloworld\android" -Name "local.properties" -ItemType "file" -Value "$sdk_dir";

for the next step, connect the Android phone to computer via USB, then\

1.6.5 To confirm that an Android device is connected, set the Android Debug Bridge to Path:
$outpath = "$Env:UserProfile\Android\PowerShell";
[Environment]::SetEnvironmentVariable("Path", "$env:Path;$outpath\platform-tools", "User");

Verifying Android Debug Bridge:

abd version

Expected output:

Android Debug Bridge version 1.0.39
Version 0.0.1-4500957
Installed as ...\Android\PowerShell\platform-tools\adb.exe
1.6.6 Confirm that an Android device is connected:
abd devices -l

Expected output:

0011111111 device product:<your_phone_product> model:<Your_Phone_Model> device:<your_phone> transport_id:1
1.6.7 Run Android helloworld application:
Set-Location $dev\helloworld;
react-native run-android

Expected output (on computer terminal):

Scanning folders for symlinks in ...\helloworld\node_modules (109ms)
┌──────────────────────────────────────────────────────────────────────────────┐
│                                                                              │
│  Running Metro Bundler on port 8081.                                         │
│                                                                              │
│  Keep Metro running while developing on any JS projects. Feel free to        │
│  close this tab and run your own Metro instance if you prefer.               │
│                                                                              │
│  https://github.com/facebook/react-native                                    │
│                                                                              │
└──────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
   ..\helloworld
Metro Bundler ready.
Loading dependency graph, done.
...
Scanning folders for symlinks in ..\helloworld\node_modules (62ms)            
Starting JS server...                                                              
Building and installing the app on the device (cd android && gradlew.bat installDebug)...
Checking the license for package Android SDK Build-Tools 23.0.1 in ...\Android\PowerShell\licenses
License for package Android SDK Build-Tools 23.0.1 accepted.                       
Preparing "Install Android SDK Build-Tools 23.0.1".                                
"Install Android SDK Build-Tools 23.0.1" ready.                                    
Finishing "Install Android SDK Build-Tools 23.0.1"                                 
Installing Android SDK Build-Tools 23.0.1 in ...\Android\PowerShell\build-tools\23.0.1
"Install Android SDK Build-Tools 23.0.1" complete.                                 
Checking the license for package Android SDK Platform 23 in ...\Android\PowerShell\licenses
License for package Android SDK Platform 23 accepted.                              
Preparing "Install Android SDK Platform 23".                                       
"Install Android SDK Platform 23" ready.                                           
Finishing "Install Android SDK Platform 23"                                        
Installing Android SDK Platform 23 in ...\Android\PowerShell\platforms\android-23   
"Install Android SDK Platform 23" complete.                                        
Checking the license for package Android Support Repository in ...\Android\PowerShell\licenses
License for package Android Support Repository accepted.                           
Preparing "Install Android Support Repository".                                    
"Install Android Support Repository" ready.                                        
Finishing "Install Android Support Repository"                                     
Installing Android Support Repository in ...\Android\PowerShell\extras\android\m2repository
"Install Android Support Repository" complete.                                     
Incremental java compilation is an incubating feature.                             
:app:preBuild UP-TO-DATE                                                           
:app:preDebugBuild UP-TO-DATE                                                      
:app:checkDebugManifest                                                            
:app:preReleaseBuild UP-TO-DATE                                                    
:app:prepareComAndroidSupportAppcompatV72301Library                                
:app:prepareComAndroidSupportSupportV42301Library
:app:prepareComFacebookFbuiTextlayoutbuilderTextlayoutbuilder100Library
:app:prepareComFacebookFrescoDrawee130Library
:app:prepareComFacebookFrescoFbcore130Library
:app:prepareComFacebookFrescoFresco130Library
:app:prepareComFacebookFrescoImagepipeline130Library
:app:prepareComFacebookFrescoImagepipelineBase130Library
:app:prepareComFacebookFrescoImagepipelineOkhttp3130Library
:app:prepareComFacebookReactReactNative0540Library
:app:prepareComFacebookSoloaderSoloader010Library
:app:prepareOrgWebkitAndroidJscR174650Library
:app:prepareDebugDependencies
:app:compileDebugAidl
:app:compileDebugRenderscript
:app:generateDebugBuildConfig
:app:mergeDebugShaders
:app:compileDebugShaders
:app:generateDebugAssets
:app:mergeDebugAssets
:app:generateDebugResValues
:app:generateDebugResources
:app:mergeDebugResources                                                           
:app:bundleDebugJsAndAssets SKIPPED                                                
:app:processDebugManifest                                                          
:app:processDebugResources                                                         
:app:generateDebugSources                                                          
:app:incrementalDebugJavaCompilationSafeguard                                      
:app:compileDebugJavaWithJavac                                                     
:app:compileDebugJavaWithJavac - is not incremental 
(e.g. outputs have changed, no previous execution, etc.).                                                         
:app:compileDebugNdk UP-TO-DATE                                                    
:app:compileDebugSources                                                           
:app:transformClassesWithDexForDebug                                               
Running dex in-process requires build tools 23.0.2.                                
For faster builds update this project to use the latest build tools.               
:app:mergeDebugJniLibFolders                                                       
:app:transformNative_libsWithMergeJniLibsForDebug                                  
:app:processDebugJavaRes UP-TO-DATE                                                
:app:transformResourcesWithMergeJavaResForDebug                                    
:app:validateSigningDebug                                                          
:app:packageDebug                                                                  
:app:assembleDebug                                                                 
:app:installDebug
Installing APK 'app-debug.apk' on '<your phone model>' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL

Total time: 39.521 secs
'adb' is not recognized as an internal or external command,
operable program or batch file.
Starting the app (...\Android\PowerShell/platform-tools/adb ...
...shell am start -n com.helloworld/com.helloworld.MainActivity...
Starting: Intent { cmp=com.helloworld/.MainActivity }

Expected output (on Android phone):

to fix it, manually:\

1.6.8 Make sure Android application assets folder exist:
$assets_dir = "$dev\helloworld\android\app\src\main";
New-Item -Path "$assets_dir\assets" -ItemType "directory";
1.6.9 React Native command for index.android.bundle file bug fix:
$bo = "android\app\src\main\index.android.bundle";
$res = "android\app\src\main\res";
Set-Location "$dev\helloworld";
react-native bundle --platform android --dev false --entry-file index.js --bundle-output $bo --assets-dest $res;

Expected output:

Scanning folders for symlinks in D:\dev\native\helloworld\node_modules (78ms)
Scanning folders for symlinks in D:\dev\native\helloworld\node_modules (204ms)
Loading dependency graph, done.
bundle: Writing bundle output to: android\app\src\main\index.android.bundle
bundle: Done writing bundle output
1.6.10 Installing missing packages for Android Application development:
npm install --save-dev babel-preset-es2016 babel-preset-react eslint-config-rallycoding;

if you receive the following error output, the next step will fix it, otherwise, skip to the next one:
Expected output:

npm WARN rm not removing ...\helloworld\node_modules\.bin\jest.cmd 
as it wasn't installed by ...\helloworld\node_modules\jest
npm WARN rm not removing ...\helloworld\node_modules\.bin\jest
as it wasn't installed by ...\helloworld\node_modules\jest
npm WARN rm not removing ...\helloworld\node_modules\.bin\jsesc.cmd
as it wasn't installed by ...\helloworld\node_modules\jsesc
npm WARN rm not removing ...\helloworld\node_modules\.bin\jsesc
as it wasn't installed by ...\helloworld\node_modules\jsesc
npm WARN rm not removing ...\helloworld\node_modules\.bin\esparse.cmd
as it wasn't installed by ...\helloworld\node_modules\esprima
npm WARN rm not removing ...\helloworld\node_modules\.bin\esvalidate.cmd
as it wasn't installed by ...\helloworld\node_modules\esprima
npm WARN rm not removing ...\helloworld\node_modules\.bin\esparse
as it wasn't installed by ...\helloworld\node_modules\esprima
npm WARN rm not removing ...\helloworld\node_modules\.bin\esvalidate
as it wasn't installed by ...\helloworld\node_modules\esprima
npm WARN rm not removing ...\helloworld\node_modules\.bin\babylon.cmd
as it wasn't installed by ...\helloworld\node_modules\babylon
npm WARN rm not removing ...\helloworld\node_modules\.bin\babylon
as it wasn't installed by ...\helloworld\node_modules\babylon
npm WARN rm not removing
...\helloworld\node_modules\@babel\traverse\node_modules\.bin\babylon.cmd
as it wasn't installed by ...\helloworld\node_modules\@babel\traverse\node_modules\babylon
npm WARN rm not removing
...\helloworld\node_modules\@babel\traverse\node_modules\.bin\babylon
as it wasn't installed by ...\helloworld\node_modules\@babel\traverse\node_modules\babylon
npm WARN rm not removing
...\helloworld\node_modules\@babel\template\node_modules\.bin\babylon.cmd
as it wasn't installed by ...\helloworld\node_modules\@babel\template\node_modules\babylon
npm WARN rm not removing
...\helloworld\node_modules\@babel\template\node_modules\.bin\babylon
as it wasn't installed by ...\helloworld\node_modules\@babel\template\node_modules\babylon
npm WARN rm not removing
...\helloworld\node_modules\@babel\core\node_modules\.bin\babylon.cmd
as it wasn't installed by ...\helloworld\node_modules\@babel\core\node_modules\babylon
npm WARN rm not removing
...\helloworld\node_modules\@babel\core\node_modules\.bin\babylon
as it wasn't installed by ...\helloworld\node_modules\@babel\core\node_modules\babylon
1.6.11 Fix NPM 'Remove-Item' command permission:
Set-Location "$dev\helloworld";
Get-ChildItem . -Recurse | where {($_ -is [System.IO.DirectoryInfo]) -eq $false} | Set-ItemProperty -Name IsReadOnly -Value $false;
npm install --save-dev babel-preset-es2016 babel-preset-react eslint-config-rallycoding;

Expected output:

-es2016 babel-preset-react eslint-config-rallycoding
npm WARN deprecated [email protected]: 🙌
Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated [email protected]: please use eslint-plugin-babel and babel/semi
+ [email protected]
+ [email protected]
+ [email protected]
updated 3 packages in 58.891s
1.6.12 Clear NPM cache and re-install node_modules:
npm cache clear --force;
npm install --save;
1.6.13 Add command line to bundle index.android.bundle file on every script run:
$bo = "android\app\src\main\index.android.bundle";
$res = "android\app\src\main\res";
$old_package_json_file = Get-Content "$dev\helloworld\package.json";
$command = "react-native bundle --platform android --dev false --entry-file index.js --bundle-output $bo --assets-dest $res";
$command += " && react-native run-android";
$insert_script = ("""test"": ""jest"",`n    ""android"": ""$command""").replace("\","/");
$new_package_json_file = $old_package_json_file.replace('"test": "jest"',$insert_script);
Set-Content -Path "$dev\helloworld\package.json" -Value $new_package_json_file;
1.6.14 Run Android Application:
npm run android

Expected output:

 [email protected] android ...\helloworld
 react-native bundle --platform android --dev false --entry-file index.js
--bundle-output android/app/src/main/index.android.bundle
--assets-dest android/app/src/main/res && react-native run-android

Scanning folders for symlinks in ...\helloworld\node_modules (101ms)
Scanning folders for symlinks in ...\helloworld\node_modules (902ms)
Loading dependency graph, done.
bundle: Writing bundle output to: android/app/src/main/index.android.bundle
bundle: Done writing bundle output
Scanning folders for symlinks in ...\helloworld\node_modules (84ms)
Starting JS server...
Building and installing the app on the device
(cd android && gradlew.bat installDebug)...

[...]

:app:assembleDebug UP-TO-DATE
:app:installDebug
Installing APK 'app-debug.apk' on '<your phone model>' for app:debug
Installed on 1 device.

BUILD SUCCESSFUL

Scanning folders for symlinks in ...\helloworld\node_modules (117ms)
┌──────────────────────────────────────────────────────────────────────────────┐
│  Running Metro Bundler on port 8081.                                         │
│  Keep Metro running while developing on any JS projects. Feel free to        │
│  close this tab and run your own Metro instance if you prefer.               │
│  https://github.com/facebook/react-native                                    │
└──────────────────────────────────────────────────────────────────────────────┘
Looking for JS files in
   ...\helloworld
Metro Bundler ready.
Loading dependency graph, done.
 BUNDLE  [android, dev] ./index.js ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 100.0% (480/480), done.

Total time: 19.212 secs
shell am start -n com.helloworld/com.helloworld.MainActivity...
Starting: Intent { cmp=com.helloworld/.MainActivity }

Expected output (on Android phone):
\


@rafacs83
Copy link

I am having problems with the command, export DCM4CHEE_ARC = ~ / dcm4chee / dcm4che-2.18.3-psql

the message that appears: bash: export: `/root/dcm4chee/dcm4chee-2.18.3-psql ': is not a valid identifier, what can it be?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment