rebar3 can't load compiled files - rabbitmq

I have used reabr3 to create an application to practice the RabbitMQ but the rebar3 can not load the additional file I created in the src folder to erlang shell.
I used rebar3 new app rabbit. I had rabbit_app.erl rabbit_sup.erl and rabbit.app.src and a new defined file named hello_world.erl in the src/ directory. I ran the rebar3 compile to compile and get dependencies.
Then ran rebar3 shell to able to test the function in hello_world.erl. The hello_world.beam can not be loaded so I have to use the c(hello_world) manually in erlang shell. It is a bit inconvenient.
Any helps would highly be appreciated. Here is the console output for rebar3 compile and rebar3 shell.
$ rebar3 compile
===> Verifying dependencies...
===> Fetching amqp_client v3.8.14
===> Fetching rabbit_common v3.8.7
===> Fetching credentials_obfuscation v2.2.0
===> Fetching jsx v2.11.0
===> Fetching lager v3.8.0
===> Fetching ranch v1.7.1
===> Fetching recon v2.5.1
===> Fetching goldrush v0.1.9
===> Analyzing applications...
===> Compiling credentials_obfuscation
===> Compiling goldrush
===> Compiling jsx
===> Compiling lager
===> Compiling ranch
===> Compiling recon
===> Compiling rabbit_common
===> Compiling amqp_client
===> Analyzing applications...
===> Compiling rabbit
$ rebar3 shell
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling rabbit
Erlang/OTP 22 [erts-10.7.2.1] [source] [64-bit] [smp:16:16] [ds:16:16:10] [async-threads:1] [hipe]
Eshell V10.7.2.1 (abort with ^G)
1> ===> Booted xmerl
===> Booted compiler
===> Booted sasl
===> Booted syntax_tools
===> Booted tools
===> Booted goldrush
===> Booted lager
===> Booted jsx
===> Booted ranch
===> Booted recon
===> Booted credentials_obfuscation
===> Booted rabbit_common
===> Booted amqp_client
===> Booted rabbit
[UPDATE] I found that the new added files were load but the auto-complete for these files did not work. I had to use the whole command for the first time.

rebar3 organizes the .beam files in directories outside the src directory. When you issue the command c(hello_world), the .beam file is placed in the current directory. Apparently, you are issuing your rebar3 commands while the current directory is the src/ directory, which is not the way things are done with rebar3. You need to be in the rabbit/ directory, i.e. the top level directory of your app, when you issue rebar3 commands like rebar3 compile and rebar3 shell.

Related

How do I debug cli react-native bundle command further? Command hangs with no error

I have been using appcenter.ms code deploy and the command:
appcenter codepush release-react -a <account>/<App> -d Production
This command hangs for eternity and never completes, here is the output:
Loading dependency graph, done.
Loading dependency graph...info Writing bundle output to:, ./CodePush/main.jsbundle
info Done writing bundle output
info Copying 34 asset files
info Done copying assets
Reading through their documentation: https://learn.microsoft.com/en-us/appcenter/distribution/codepush/cli. I tried to create the bundle myself prior to deploying, and it turns out this command is where it hangs:
react-native bundle --platform ios --entry-file index.js --bundle-output ./CodePush/main.jsbundle --assets-dest ./CodePush
Same output as above.
I have a hunch it has to do with an npm module I have added because it was working at some point recently, but I am unsure how to get more information to troubleshoot the issue further. Any help would be appreciated.
I had installed react-native-clean-project as an npm module by mistake, once removed everything worked as expected again. Not sure exactly what the issue was because of the lack of log output.

Confused about which Vuejs files to push to NPM for a library

I am on windows, using Vuejs trying to build my own library and push to NPM.
These are my working environments:
$ node -v
v10.16.0
$ npm -v
6.9.0
$ vue -V
3.8.4
I followed cli.vuejs.org/guide/build-targets.html page to build my library, and finally after running:
vue-cli-service build --target lib --name myLib ./src/index.js
I can see the output just like in here or here from my output:
You may use special comments to disable some warnings.
Use // eslint-disable-next-line to ignore the next line.
Use /* eslint-disable */ to ignore all warnings in a file.
File Size Gzipped
dist\my-vue-lib.umd.min.js 28.90 KiB 10.02 KiB
dist\my-vue-lib.umd.js 81.10 KiB 20.21 KiB
dist\my-vue-lib.common.js 80.71 KiB 20.09 KiB
Images and other types of assets omitted.
The thing I don't understand is, when I push my package to NPM, do I only push these files? Or do I push the whole root of my directory (without node_modules)
Some things are not clear or mentioned in the docs, or maybe they are assumed everyone knows. But after the build process is success, do I push my entire folder to NPM?
Just to be clear, when I initialized the project I used the command
vue create my-vue-lib
and it generated everything from readme, package.json, tests/ ... I asked this because before the new vue-cli the process was different.
So to sum it up, after the build process is success, what do I push to NPM?
Just push your dist, the rest is not needed. Create a .npmignore put in your ./src** that should be ok.

Errors when Pushing Vue.js app with IBM Cloud+Cloud Foundry Node Buildpack

I am really new (this is my first time) to using IBM Cloud.I have a Vue.js app that I would like to deploy on IBM Cloud with continuous delivery. I have my Vue project in a GitHub repository, and I would like to be able to deploy the project automatically upon changes to the master branch of the repository. I have successfully set up the tool chain so that the "Delivery Pipeline" runs upon changes to the master branch. See screenshot:
Within the Delivery Pipeline, I have two stages: Build and Deploy. See screenshot 2:
I (think) I have successfully set up the Build Stage, where I install npm, then proceed to run the command "npm run build" to create a deployable bundle, with this script:
bash
#!/bin/bash
export NODE_VERSION=8
export NVM_VERSION=0.33.11
npm config delete prefix \
&& curl -o-
https://raw.githubusercontent.com/creationix/nvm/v${NVM_VERSION}
/install.sh | bash \
&& export NVM_DIR="$HOME/.nvm" \
&& . $NVM_DIR/nvm.sh \
&& nvm install $NODE_VERSION \
&& nvm alias default $NODE_VERSION \
&& nvm use default \
&& node -v \
&& npm -v
echo "Installing NPM"
npm install
echo "NPM install successful"
echo "Attempting npm run build"
npm run build
echo "NPM run build successful"
This is where the uncertainty arises. I want to deploy the project, which after npm run build should just require index.hmtl and build.js, which is in the 'dist' folder.
I don't know if this is necessary, but following the npm install and npm run build stage, I added this stage, which I really don't know what does. I have only added it because the boilerplate SDK for Node.js™
had this stage prior to the deploy stage, see screenshot 3:
After this, I have the Deploy stage set to take the 'Simple Build' stage as its input. It deploys it with a simple cloud foundry push command. However, I get these errors in the log, after it downloads the various buildpacks:
Staging...
-----> IBM SDK for Node.js Buildpack v3.25.1-20190115-1637
Based on Cloud Foundry Node.js Buildpack v1.5.24
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NPM_CONFIG_PRODUCTION=true
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version (latest stable) via 'node-version-resolver'
Installing Node.js (6.16.0) from cache
Using default npm version: 3.10.10
-----> Restoring cache
Loading 2 from cacheDirectories (default):
- node_modules
- bower_components (not cached - skipping)
-----> Building dependencies
Installing node modules (package.json)
-----> Installing App Management
WARN: App Management cannot be installed because the start script cannot be found.
To install App Management utilities, specify your 'node' start script in 'package.json' or 'Procfile'.
Checking for Dynatrace credentials
No Dynatrace Service Found (service with substring dynatrace not found in VCAP_SERVICES)
-----> Caching build
Clearing previous node cache
Saving 2 cacheDirectories (default):
- node_modules
- bower_components (nothing to cache)
-----> Build succeeded!
└── vue#2.6.10
! This app may not specify any way to start a node process
http://docs.cloudfoundry.org/buildpacks/node
Exit status 0
Staging complete
Uploading droplet, build artifacts cache...
Uploading build artifacts cache...
Uploading droplet...
Uploaded build artifacts cache (15.3M)
Uploaded droplet (29.4M)
Uploading complete
Stopping instance 64ed3f5f-71eb-477b-afc1-0e07e2e74fdb
Destroying container
Successfully destroyed container
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 starting
0 of 1 instances running, 1 crashed
FAILED
Error restarting application: Start unsuccessful
Any ideas? Where am I going wrong? Any help would be greatly appreciated!
Got it working. I just needed to add the dependencies/require statements in the app.js file (some Express stuff), and then I removed that extra 'Simple build" stage

Yarn publish is publishing state of package PRIOR to the prepublish script

In my package.json, I have the following script:
"scripts": {
"build": "tsc",
"prepublish": "yarn build"
},
I would expect that when I issue the command "yarn publish" it would run the prepublish script, which would itself cause the build script to run, which would run the typescript compiler, and when publish happened, the new javascript that is generated by the typescript compiler would part of the published package.
And looking at the output of the yarn publish command, this looks like what is happening:
C:\> yarn publish
yarn publish v1.0.2
[1/4] Bumping version...
info Current version: 0.0.2
question New version: 0.0.3
info New version: 0.0.3
[2/4] Logging in...
[3/4] Publishing...
$ tsc
success Published.
[4/4] Revoking token...
info Not revoking login token, specified via config file.
Done in 17.20s.
So it looks fine. And when I am done with this, the javascript in my local package directory is fine.
However, if I now install that package elsewhere with yarn install, the installed package has the javascript that was in place BEFORE the typescript compiler (tsc) was run. Almost as if what was packaged up for publication was the state of the world BEFORE the prepublish script. This seems both wrong and counter-intuitive.
Is this a bug or am I misunderstanding something fundamental?

Provide a valid path to the desired application bundle. Print: Entry, ":CFBundleIdentifier", Does Not Exist

react-native-cli: 1.0.0
react-native: 0.39.2
I cloned a react native project. Then I ran npm install and then react-native run-ios. The project fails with the below error.
Please not the project runs fine in xcode.
Any thoughts?
The following commands produced analyzer issues:
Analyze RCTLocationObserver.m
(1 command with analyzer issues)
The following build commands failed:
CompileC /Users/jordanmc/Documents/src/Safetypin%20React-Native/ios/build/Build/Intermediates/RCTLinking.build/Debug-iphonesimulator/RCTLinking.build/Objects-normal/x86_64/RCTLinkingManager.o RCTLinkingManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/jordanmc/Documents/src/Safetypin%20React-Native/ios/build/Build/Intermediates/RCTGeolocation.build/Debug-iphonesimulator/RCTGeolocation.build/Objects-normal/x86_64/RCTLocationObserver.o RCTLocationObserver.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
CompileC /Users/jordanmc/Documents/src/Safetypin%20React-Native/ios/build/Build/Intermediates/RCTText.build/Debug-iphonesimulator/RCTText.build/Objects-normal/x86_64/RCTTextManager.o RCTTextManager.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(3 failures)
Installing build/Build/Products/Debug-iphonesimulator/Safetypin.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist
Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/Safetypin.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist
So, I had the same problem Jordan. react-native run-ios creates the Products & Intermediates folder in the ./ios/build folder, but the issue is the valid path is pointing to ./ios/build/Build. What I've been doing is I manually create the Build/ folder inside ./ios/build by issuing the command below:
cd ./ios/build
mkdir Build
cd Build
then, I symlink the folders:
ln -s ../Products .
ln -s ../Intermediates .
You should be able to get react-native run-ios to work again.