MobileFirst 7.0 CLI - Unable to Start Server - ibm-mobilefirst

I'm running into issues trying to preview the mobilefirst app. I was able to run and preview the app earlier but not sure what changed.
mfp start -dd
mobilefirst-cli verb cli process.argv=["/Applications/IBM/MobileFirst-CLI/IBMnode/bin/node","/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/bin/mobilefirst-cli.js","start","-dd"]
mobilefirst-cli verb cli opts={"ddebug":true,"argv":{"remain":["start"],"cooked":["start","--ddebug"],"original":["start","-dd"]}}
mobilefirst-cli verb cli mobilefirst#7.0.0.00.20150430-1604
mobilefirst-cli verb cli node#v0.10.30
Initializing MobileFirst Console.
mobilefirst-cli verb ant variables -Dbasedir=/Users/extremeblueaustin/Walmart/2015-walmart/mobile
mobilefirst-cli verb ant variables -Dworklight.jars.dir=/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib
mobilefirst-cli verb ant variables -Dworklight.ant.tools.dir=/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/ant-tools
mobilefirst-cli verb ant variables -Dworklight.hostname=9.41.78.128
mobilefirst-cli verb ant variables -file=/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/build.xml
mobilefirst-cli verb ant task build-WAR
Buildfile: /Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/build.xml
build-WAR:
[echo] Building worklight WAR for project mobile
mobilefirst-cli verb cli finish with mobilefirst start
mobilefirst-cli verb code 1
When I go to build and preview, it says to run 'mobilefirst start'.
mfp preview -d
mobilefirst-cli verb cli process.argv=["/Applications/IBM/MobileFirst-CLI/IBMnode/bin/node","/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/bin/mobilefirst-cli.js","preview","-d"]
mobilefirst-cli verb cli opts={"debug":true,"argv":{"remain":["preview"],"cooked":["preview","--debug"],"original":["preview","-d"]}}
mobilefirst-cli verb cli mobilefirst#7.0.0.00.20150430-1604
mobilefirst-cli verb cli node#v0.10.30
mobilefirst-cli verb cli start with
mobilefirst preview
Initializing MobileFirst Console.
mobilefirst-cli verb ant variables - Dbasedir=/Users/user/folder/folder/mobile ** redacted **
mobilefirst-cli verb ant variables -Dworklight.jars.dir=/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib
mobilefirst-cli verb ant variables -Dworklight.ant.tools.dir=/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/ant-tools
mobilefirst-cli verb ant variables -Dworklight.hostname=9.41.78.128
mobilefirst-cli verb ant variables -file=/Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/build.xml
mobilefirst-cli verb ant task build-WAR
Buildfile: /Applications/IBM/MobileFirst-CLI/mobilefirst-cli/node_modules/generator-worklight-server/lib/build.xml
build-WAR:
[echo] Building worklight WAR for project mobile
Error: The MobileFirst server that you have configured does not appear to be running. Start the server with 'mobilefirst start'.
mobilefirst-cli verb cli finish with mobilefirst preview
mobilefirst-cli verb code 126
Let me know what else is needed and I will edit the question.

I fix the problemn installing the JDK 7.
I used the JDK 8.
Check this: mobile first cli project deploy failing

Can you check if your JAVA_HOME environment variable is set to jdk directory. This same issue occurred to me when I lacked the JAVA_HOME in my environment.

Related

expo.dev (cloud service) add flags to npm install

The following command eas build --platform ios --profile=production is executed to build the local expo project to expo.dev (cloud service)
During the install dependency phase of expo.dev (cloud service) in the image below, the following error is received:
[stderr] npm ERR! Fix the upstream dependency conflict, or retry
[stderr] npm ERR! this command with --force, or --legacy-peer-deps
The question is how can I add flag --force to expo.dev(cloud service) such that when it installs dependencies it executes npm install --force instead of npm install
Image Of Error From expo.dev :

How to pass argument from npm script to lerna command

I am looking to pass stage argument from npm script to lerna which will call npm script in each of the packages.
Here's what it looks like:
In deploy.sh, I run:
npm run deploy:cicd -- --stage dev
In package.json, I have:
"deploy:cicd": " lerna run deploy --stream",
In each of the packages, the deploy script looks like this:
"deploy": "sls deploy -v",
I need to be able to pass the stage name from deploy.sh so that the deploy command executed in each of the packages will be :
"sls deploy -v --stage dev ",
Currently, I get an error:
> lerna run deploy --stream "-stage" "dev"
ERR! lerna Unknown arguments: p, r, o, f, i, l, e
npm ERR! code 1
npm ERR! path /codebuild/output/src202136904/src
npm ERR! command failed
npm ERR! command sh -c lerna run deploy --stream "-stage" "dev"
In deploy.sh, I tried passing
npm run deploy:cicd -- -- -stage dev
and
npm run deploy:cicd -- -stage dev
and
npm run deploy:cicd -- stage dev
Neither of these has worked for me.

Execution failed for task ':app:validateSigningDebug'. in ReactNative

I am trying to run the app for the first time
C:\Users\Devrath\Desktop\React\ReactProjectFirst> npm run android
Question: Should I need to create a keystore for simply running a app
Error:
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 855 file(s) to forward-jetify. Using 4 workers...
info Starting JS server...
info Installing the app...
> Task :app:validateSigningDebug FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.4.1/userguide/command_line_interface.html#sec:command_line_warnings
17 actionable tasks: 2 executed, 15 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:validateSigningDebug'.
> Keystore file 'C:\Users\Devrath\Desktop\React\ReactProjectFirst\android\app\debug.keystore' not found for signing config 'debug'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:validateSigningDebug'.
> Keystore file 'C:\Users\Devrath\Desktop\React\ReactProjectFirst\android\app\debug.keystore' not found for signing config 'debug'.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 13s
at checkExecSyncError (child_process.js:621:11)
at execFileSync (child_process.js:639:15)
at runOnAllDevices (C:\Users\Devrath\Desktop\React\ReactProjectFirst\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (C:\Users\Devrath\Desktop\React\ReactProjectFirst\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\Users\Devrath\Desktop\React\ReactProjectFirst\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:85:5)
at async Command.handleAction (C:\Users\Devrath\Desktop\React\ReactProjectFirst\node_modules\react-native\node_modules\#react-native-community\cli\build\cliEntry.js:160:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! AwesomeProject#0.0.1 android: `react-native run-android`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the AwesomeProject#0.0.1 android script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Devrath\AppData\Roaming\npm-cache\_logs\2019-08-12T11_38_19_074Z-debug.log
Please make sure you have executed it in this order.
Environment
Android Studio
Built-in emulator in Android Studio
Node Package Manager (NPM)
Node.js (Version 8 or newer)
React Native command line interface (React Native CLI)
Java Development Kit (JDK 8 or newer)
npm install -g react-native-cli
react-native init ReactProjectFirst
react-native run-android

CodeBuild failing to run CDK synth

I'm having a problem running cdk synth on codebuild, it just says: You are not authorized to perform this operation.
It's a CDK application to provision some infrastructure using #aws-cdk/app-delivery dependency to create the CI/CD pipeline. The codebuild image I'm using is: aws/codebuild/nodejs:10.1.0
The buildspec.yml is a standard one that app-delivery shares in their readme, just adding --loglevel verbose to have a better understanding of what's happenning
phases:
install:
commands:
# Installs the npm dependencies as defined by the `package.json` file
# present in the root directory of the package
# (`cdk init app --language=typescript` would have created one for you)
- npm install
build:
commands:
# Builds the CDK App so it can be synthesized
- npm run build
# Synthesizes the CDK App and puts the resulting artifacts into `dist`
- npm run cdk synth --loglevel verbose -- -o dist
artifacts:
# The output artifact is all the files in the `dist` directory
base-directory: dist
files: '**/*'
And here are the codebuild logs:
[Container] 2019/06/06 19:20:11 Running command npm run cdk synth --loglevel verbose -- -o dist
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli '/usr/local/bin/npm',
npm verb cli 'run',
npm verb cli 'cdk',
npm verb cli 'synth',
npm verb cli '--loglevel',
npm verb cli 'verbose',
npm verb cli '--',
npm verb cli '-o',
npm verb cli 'dist' ]
npm info using npm#5.6.0
npm info using node#v10.1.0
npm verb run-script [ 'precdk', 'cdk', 'postcdk' ]
npm info lifecycle dvi-infrastructure-cdk#0.1.0~precdk: dvi-infrastructure-cdk#0.1.0
npm info lifecycle dvi-infrastructure-cdk#0.1.0~cdk: dvi-infrastructure-cdk#0.1.0
> dvi-infrastructure-cdk#0.1.0 cdk /codebuild/output/src891487954/src
> cdk "synth" "-o" "dist"
You are not authorized to perform this operation.
npm verb lifecycle dvi-infrastructure-cdk#0.1.0~cdk: unsafe-perm in lifecycle true
npm verb lifecycle dvi-infrastructure-cdk#0.1.0~cdk: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/codebuild/output/src891487954/src/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
npm verb lifecycle dvi-infrastructure-cdk#0.1.0~cdk: CWD: /codebuild/output/src891487954/src
npm info lifecycle dvi-infrastructure-cdk#0.1.0~cdk: Failed to exec cdk script
npm verb stack Error: dvi-infrastructure-cdk#0.1.0 cdk: `cdk "synth" "-o" "dist"`
npm verb stack Exit status 1
npm verb stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
npm verb stack at EventEmitter.emit (events.js:182:13)
npm verb stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack at ChildProcess.emit (events.js:182:13)
npm verb stack at maybeClose (internal/child_process.js:957:16)
npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:246:5)
npm verb pkgid dvi-infrastructure-cdk#0.1.0
npm verb cwd /codebuild/output/src891487954/src
npm verb Linux 4.14.114-83.126.amzn1.x86_64
npm verb argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "cdk" "synth" "--loglevel" "verbose" "--" "-o" "dist"
npm verb node v10.1.0
npm verb npm v5.6.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! dvi-infrastructure-cdk#0.1.0 cdk: `cdk "synth" "-o" "dist"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the dvi-infrastructure-cdk#0.1.0 cdk script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-06-06T19_20_13_082Z-debug.log
[Container] 2019/06/06 19:20:13 Command did not exit successfully npm run cdk synth --loglevel verbose -- -o dist exit status 1
[Container] 2019/06/06 19:20:13 Phase complete: BUILD State: FAILED
[Container] 2019/06/06 19:20:13 Phase context status code: COMMAND_EXECUTION_ERROR Message: Error while executing command: npm run cdk synth --loglevel verbose -- -o dist. Reason: exit status 1
I've been able to check which was the error by running npm run cdk synth -- -v -o dist command in my buildspec.yml. With that I got the following error:
Some context information is missing. Fetching...
Reading AZs for 244496089465:us-west-2
Using default AWS SDK credentials for account 244496089465
You are not authorized to perform this operation.
UnauthorizedOperation: You are not authorized to perform this operation.
at Request.extractError (/codebuild/output/src133069252/src/node_modules/aws-sdk/lib/services/ec2.js:50:35)
at Request.callListeners (/codebuild/output/src133069252/src/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/codebuild/output/src133069252/src/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/codebuild/output/src133069252/src/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/codebuild/output/src133069252/src/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/codebuild/output/src133069252/src/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /codebuild/output/src133069252/src/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/codebuild/output/src133069252/src/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/codebuild/output/src133069252/src/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/codebuild/output/src133069252/src/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
So, by adding the following permission ec2:DescribeAvailabilityZones into the codebuild role solved my problem

On Premise Agent does not download all NPM packages

Edit: 2018-02-28 - add screen shot of build definition
I am having a problem with an on premise VSTS Agent. When 'npm install' runs, it only installs about 20% of the packages. the command does not error out. If I run the same NPM install command when I remote into the machine all the packages are installed. I used the same steps manually that are in the Visual Studio Team Services Hosted Images scripts. Specifically Install-NodeLts.ps1
I need to get the local agent running so our builds will complete.
npm/5.6.0 node/v8.9.4 win32 x64
You can see below it says: 'added 559 packages in 37.875s', but when run npm install from command line via RDP, it installs 2419 packages.
I have tried:
re-install NPM as a task
run npm install twice as two different tasks
run npm install from a command task
run agent as my same user account
Partial output log:
2018-02-27T21:30:59.6386335Z ##[section]Starting: npm install
2018-02-27T21:30:59.6396849Z ==============================================================================
2018-02-27T21:30:59.6397102Z Task : npm
2018-02-27T21:30:59.6397398Z Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Package Management.
2018-02-27T21:30:59.6397690Z Version : 1.0.10
2018-02-27T21:30:59.6397884Z Author : Microsoft Corporation
2018-02-27T21:30:59.6398144Z Help : [More Information](https://go.microsoft.com/fwlink/?LinkID=613746)
2018-02-27T21:30:59.6398400Z ==============================================================================
2018-02-27T21:31:00.7066189Z [command]C:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" --version"
2018-02-27T21:31:02.6879301Z 5.6.0
2018-02-27T21:31:07.0100259Z [command]C:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" config list"
2018-02-27T21:31:09.1937476Z npm info it worked if it ends with ok
2018-02-27T21:31:09.1938350Z npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
2018-02-27T21:31:09.1938614Z npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
2018-02-27T21:31:09.1938859Z npm verb cli 'prefix',
2018-02-27T21:31:09.1939038Z npm verb cli '-g' ]
2018-02-27T21:31:09.1939210Z npm info using npm#5.6.0
2018-02-27T21:31:09.1939414Z npm info using node#v8.9.4
2018-02-27T21:31:09.1939594Z npm verb exit [ 0, true ]
2018-02-27T21:31:09.1939806Z npm info ok
2018-02-27T21:31:09.1940065Z npm info it worked if it ends with ok
2018-02-27T21:31:09.1940314Z npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
2018-02-27T21:31:09.1940577Z npm verb cli 'C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js',
2018-02-27T21:31:09.1940790Z npm verb cli 'config',
2018-02-27T21:31:09.1941046Z npm verb cli 'list' ]
2018-02-27T21:31:09.1941258Z npm info using npm#5.6.0
2018-02-27T21:31:09.1941470Z npm info using node#v8.9.4
2018-02-27T21:31:09.1941711Z npm verb exit [ 0, true ]
2018-02-27T21:31:09.1941956Z npm info ok
2018-02-27T21:31:09.1942165Z ; cli configs
2018-02-27T21:31:09.1942384Z metrics-registry = "https://registry.npmjs.org/"
2018-02-27T21:31:09.1942647Z scope = ""
2018-02-27T21:31:09.1942849Z user-agent = "npm/5.6.0 node/v8.9.4 win32 x64"
2018-02-27T21:31:09.1942977Z
2018-02-27T21:31:09.1943141Z ; environment configs
2018-02-27T21:31:09.1943350Z cache = "C:\\npm\\cache"
2018-02-27T21:31:09.1943529Z loglevel = "verbose"
2018-02-27T21:31:09.1943712Z prefix = "C:\\npm\\prefix"
2018-02-27T21:31:09.1943927Z userconfig = "D:\\VSTSAgent\\vsts-agent-win-x64-2.129.1\\_work\\2\\npm\\187.npmrc"
2018-02-27T21:31:09.1944096Z
2018-02-27T21:31:09.1944268Z ; builtin config undefined
2018-02-27T21:31:09.1944399Z
2018-02-27T21:31:09.1944626Z ; node bin location = C:\Program Files\nodejs\node.exe
2018-02-27T21:31:09.1944941Z ; cwd = D:\VSTSAgent\vsts-agent-win-x64-2.129.1\_work\2\s\Web
2018-02-27T21:31:09.1945215Z ; HOME = C:\Users\bolducp
2018-02-27T21:31:09.1945445Z ; "npm config ls -l" to show all defaults.
2018-02-27T21:31:09.1945592Z
2018-02-27T21:31:09.1947815Z [command]C:\WINDOWS\system32\cmd.exe /D /S /C ""C:\Program Files\nodejs\npm.cmd" install"
2018-02-27T21:31:50.2618021Z npm info it worked if it ends with ok
2018-02-27T21:31:50.2618358Z
2018-02-27T21:31:50.2623471Z > react-bootstrap-select#0.14.0 postinstall D:\VSTSAgent\vsts-agent-win-x64-2.129.1\_work\2\s\Web\node_modules\react-bootstrap-select
2018-02-27T21:31:50.2624421Z npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
2018-02-27T21:31:50.2624674Z > jsx jsx/ dist/
2018-02-27T21:31:50.2624944Z npm verb cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
2018-02-27T21:31:50.2625391Z
2018-02-27T21:31:50.2625873Z ["Select"]
2018-02-27T21:31:50.2627029Z added 559 packages in 37.875s
2018-02-27T21:31:50.2636988Z npm verb cli 'prefix',
2018-02-27T21:31:50.2637434Z npm verb cli '-g' ]
2018-02-27T21:31:50.2639621Z npm info using npm#5.6.0
2018-02-27T21:31:50.2639731Z npm info using node#v8.9.4
2018-02-27T21:31:50.2639837Z npm verb exit [ 0, true ]
2018-02-27T21:31:50.2640063Z npm info ok
2018-02-27T21:31:50.2640199Z npm info it worked if it ends with ok
2018-02-27T21:31:50.2640352Z npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
2018-02-27T21:31:50.2640480Z npm verb cli 'C:\\npm\\prefix\\node_modules\\npm\\bin\\npm-cli.js',
2018-02-27T21:31:50.2640597Z npm verb cli 'install' ]
2018-02-27T21:31:50.2640700Z npm info using npm#5.6.0
2018-02-27T21:31:50.2640835Z npm info using node#v8.9.4
2018-02-27T21:31:50.2640945Z npm verb npm-session 7bedb538a9b4e7b7
2018-02-27T21:31:50.2641065Z npm info lifecycle company-project#1.0.0~preinstall: company-project#1.0.0
2018-02-27T21:31:50.2641230Z npm http fetch GET 304 https://registry.npmjs.org/moment 375ms (from cache)
...
2018-02-27T21:31:50.3412460Z npm verb exit [ 0, true ]
2018-02-27T21:31:50.3412559Z npm info ok
2018-02-27T21:31:50.3416231Z ##[section]Finishing: npm install
When setting up the hosted agent, I had modified the build definition to include an environment variable NODE_ENV=production. When the NODE_ENV environment variable is set to production, npm will not install modules listed in devDependencies.