Moonmail installation issue - Command "project" not found - serverless-framework

I'm initializing Moonmail and following the readme, executing the following command:
sls project init -c -n your-lower-case-project-name
I'm getting the following:
Command "project" not found, Run "serverless help" for...
It seems that Serverless no longer has the "project" command (since version 0.5) and it has been replaced with "service" (which works a little differently).
What would be the way forward here?

Although they say that Moonmail supports version 0.5.2 or higher, it's not true. You need to use version 0.5x of the Serverless Framework and you can't use any version 1.x because 1.x is a complete rewrite.
Unfortunately, the solution is to uninstall the current Serverless Framework and install an old version.
npm -g uninstall serverless
npm -g install serverless#0.5.6

Related

NVM for windows is failing when using npm prestart scripts

When I try to run my project, doing npm start I am getting the below. We have this chain in our project since some repos are using different node versions. I have nvm-windows 1.1.9 latest installed. I have tried a machine recycle, re-installing nvm for windows, deleting the packages and modules and much more. Whats interesting is that when I remove the prestart script and am on the required version by doing nvm use 18.4.0 this works, also when I add back in the prestart script and use for instance nvm use 12.22.12 the prestart script executes fine when running npm start and the version changes t0 18.4.0 with no issue, but if I stop the project and start it again it fails with the below and either I need to remove the prestart script or change to a different version. I am not understanding how this could be.
prestart
nvm install 18.4.0 && nvm use 18.4.0
This is not the package you are looking for: please go to http://nvm.sh

AWS CodeBuild error: Major version of alias '14.x' is not supported in runtime 'nodejs'

I have a confusing issue with AWS CodeBuild. I am getting the following error:
Major version of alias '14.x' is not supported in runtime 'nodejs'
When I update the buildspec to simply be "14" I get slightly more information on the error:
Message: Unknown runtime version named '14' of nodejs. This build image has the following versions: 10, 12
We have been using this CodeBuild project for a long time using 12.x and now require to update to 14.x. We have updated the buildspec as follows:
version: 0.2
phases:
install:
runtime-versions:
nodejs: 14.x
build:
commands:
- "npm i"
- "npm run build"
- "npm run db:migrate"
artifacts:
files:
- "all"
- "of"
- "our"
- "files"
Additionally, our CodeBuild is already on the latest version of the CodeBuild image. I have even re-built the CodeBuild project to make sure it is the latest and still the same issue:
aws/codebuild/amazonlinux2-x86_64-standard:3.0
Thank you in advance for any advice.
Thankfully we have solved this now!
The issue was with the CodeBuild image:
aws/codebuild/amazonlinux2-x86_64-standard:3.0
As per the available runtimes documentation it turns out we cannot use Amazon Linux 2 at all, we had to change to "Ubuntu Standard 5".
I hope this helps someone in the future.
If you absolutely need to use Amazon Linux 2 instead of Ubuntu, you can install Node 14 using the pre-installed n package in CodeBuild:
version: 0.2
phases:
install:
commands:
- n 14.18.3
build:
commands:
- npm i #etc
In our case we needed to build dependencies to run in Lambda. Since Lambda runs a version of Amazon Linux 2, building these dependencies in Ubuntu didn't work (for complicated sub-dependency reasons).
Tried and didn't work:
uninstall and install node in CodeBuild: when we ran node --version it still said 12
install and manage versions with nvm: ran into problems getting the nvm command to register
Then we realized that n was already pre-installed in CodeBuild and managing the node version.
In the end, no complicated commands needed.
select the build image that supports your runtime from here https://docs.aws.amazon.com/codebuild/latest/userguide/available-runtimes.html

Serverless framework running Java code hangs

I'm running Serverless 2.15.0 with Node 14.15.0. I've tried installing both with npm i -g and by using the curl script in the tutorial. I have Maven 3.6.3 installed
When I try to run a simple Java "hello world" function locally, I get this message:
Serverless: Building Java bridge, first invocation might take a bit longer.
Then Serverless just hangs. No error message, nothing. When I try to run with SLS_DEBUG=*, there are no messages after that point.
The only thing I've been able to Google is this, but there isn't any resolution to the problem. The other thing I've found is this but there seems to be no java directory where Serverless is installed, so I can't manually compile the pom file.
Anyone know how to fix this problem?
The problem is that they moved the path of the java runtime wrapper. Base paths differ regarding install location.
NVM (global installation)
cd ~/.nvm/versions/node/v16.13.1/lib/node_modules/serverless/lib/plugins/aws/invoke-local/runtime-wrappers/java
mvn package
NPM (global installation)
cd ~/.npm-global/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/runtimeWrappers/java
mvn package
Homebrew
cd /usr/local/Cellar/serverless/2.29.0/libexec/lib/node_modules/serverless/lib/plugins/aws/invokeLocal/runtimeWrappers/java
mvn package
Replace 2.29.0 with installed serverless version.

yarn updating package version with git tag message

I know that npm can set the git tag message when updating a package version like this
npm version patch -m "Upgrade to %s for reasons"
how can we do that in yarn?
According to the documentation, you can do it by setting setting your yarn configuration.
yarn config set version-git-message "Upgrade to %s for reasons"
There does not appear to be a documented command-line option. One workaround might be to run the command above before running yarn version and then running a yarn config command to unset version-git-message. It may also be possible to use git hooks to achieve what you need.

npm install "No compatible version found" for everything

Upon executing the following command:
npm install #angular/animations#'^5.2.0' #angular/common#'^5.2.0' #angular/compiler#'^5.2.0' #angular/compiler-cli#'^5.2.0' #angular/core#'^5.2.0' #angular/forms#'^5.2.0' #angular/http#'^5.2.0' #angular/platform-browser#'^5.2.0' #angular/platform-browser-dynamic#'^5.2.0' #angular/platform-server#'^5.2.0' #angular/router#'^5.2.0' typescript#2.4.2 rxjs#'^5.5.2'
I get messages saying that no compatible version of found for rxjs. Then when I remove the specific version, it says no compatible version is found for angular/animations. Then angular/common. Etc etc.
I'm pretty sure these versions are valid, since they're the ones recommend by this Angular upgrade tool (https://angular-update-guide.firebaseapp.com/) and I can also see the "valid install target" list, which includes the versions I'm trying to install.
I know our project's dependencies are in some special repository somewhere (Artifactory, I think?) so maybe this is happening because these versions are not in the repo NPM is looking at.
Is there a way to fix this for testing purposes before committing to having to install the new versions in the repo? In other words, how do I point NPM at the NPM repo rather than the company's repo?
Well, the answer I was looking for was here:
How to specify registry while doing npm install with git remote url?
However that didn't actually work.
The problem was simply a syntax issue. After I removed all the quotes from my command so it looked like the following command, it worked
npm install #angular/animations#^5.2.0 #angular/common#^5.2.0 #angular/compiler#^5.2.0 #angular/compiler-cli#^5.2.0 #angular/core#^5.2.0 #angular/forms#^5.2.0 #angular/http#^5.2.0 #angular/platform-browser#^5.2.0 #angular/platform-browser-dynamic#^5.2.0 #angular/platform-server#^5.2.0 #angular/router#^5.2.0 typescript#2.4.2 rxjs#^5.5.2