I tried to install aws amplify. But when I typed those commands in cmd window
then an error message came out.
>amplify configure
"amplify" is not an internal or external command .....
In this case, what should I do?
--I'm using Windows10
You need to install the amplify-cli first.
npm install -g #aws-amplify/cli
If you have already done so, opening a new commandline and typing
amplify configure
Should begin the configuration process.
You need to install Amplify CLI and configure it first.
Install Node.js in your system
Install amplify cli using the command
npm install -g #aws-amplify/cli
Related
I'm trying to circumvent the well-known issue with the latest versions of NPM and AWS Elastic Beanstalk where npm install fails because it can't find node_modules. I'm using platform hooks with my NUXTJS application.
It fails when AWS Code Pipeline runs a deploy and returns with this warning:
[ERROR] An error occurred during execution of command [app-
deploy] - [Use NPM to install dependencies]. Stop running the
command. Error: Command /bin/sh -c npm --production install
failed with error signal: killed. Stderr:npm WARN config
production Use `--omit=dev` instead.
So, I've added platform hooks at the app root but it's still failing. Also, I have added an environment variable to the EBS environment of:
NODE_ENV=production
Here's what my platform hooks look like. I thought this would work but something is obviously wrong. Can anyone spot it? Thanks for any helpful tips.
The custom-prebuild-script.sh looks like this:
#!/bin/bash
mkdir node_modules
In shell scripts interacting with the AWS CDK Toolkit, I often see both npx -- cdk and npx -- aws-cdk. Apparently, there are two npm packages cdk and aws-cdk. What is the difference between these two?
Moreover, I make confusing observations when interacting with these two packages.
npx -- cdk --version # output: Need to install the following packages: cdk#2.32.1
npx -- aws-cdk --version # output: Need to install the following packages: aws-cdk#2.32.1
Since neither package is installed locally, both commands want to install the corresponding package, fine.
npm install -g cdk#2.32.0
npx -- cdk --version # output: 2.32.0 (build 00e0c2d)
npx -- aws-cdk --version # output: Need to install the following packages: aws-cdk#2.32.1
After installing cdk locally, npx -- cdk executes the local package and npx -- aws-cdk still wants to install aws-cdk, also fine.
npm install -g aws-cdk#2.32.0
npx -- cdk --version # output: 2.32.0 (build 00e0c2d)
npx -- aws-cdk --version # output: Need to install the following packages: aws-cdk#2.32.1
Now it gets confusing. Although we locally installed aws-cdk rather than cdk, npx -- cdk still executes some local package and npx -- aws-cdk still wants to install aws-cdk. Why?
The aws-cdk package provides a cdk command, the entry point to the AWS Cloud Development Kit.
When you install aws-cdk package in node_modules/.bin there is a cdk command installed.
This allows one to use cdk command inside package.json scripts.
The cdk command is also the only command added to .bin by aws-cdk.
As per all of the documentation, in order to interact with AWS CDK from CLI, one should use cdk command. That is even though the package name is aws-cdk.
Now, the npx provides a convenient way to run a command from a package regardless if it is already installed.
This works in the most straightforward way when the package name matches the command name it provides. This is not the case for aws-cdk.
In order to fix that, and allow anyone to run npx cdk ... the AWS CDK decided to publish a package named cdk. This is a small wrapper around cdk command provided by aws-cdk package.
I am trying my hands with AWS CDK & as the first step, I need to install cdk & as per below link
https://docs.aws.amazon.com/cdk/latest/guide/getting_started.html
I tried installing the same
Steps.
node --version => v15.14.0
npm --version => 7.11.2
aws -version => aws-cli/2.2.1 Python/3.8.8 Windows/10 exe/AMD64 prompt/off`
npm -g install typescript
aws configure (AWS AccessKey, Secret,Region)
npm -g install aws-cdk
Now closed all the cmd instances & ran
cdk --version
this throws the below error
'cdk' is not recognized as an internal or external command
Then I added the below path of cdk to environment variable
C:\Users\kgn-dev\AppData\Roaming\npm\node_modules\aws-cdk\bin\cdk
still the same issue.
How do I get cdk command running?
I am using Windows 10
try to add the following path to the environment variable
C:\Users\kgn-dev\AppData\Roaming\npm\node_modules\aws-cdk\bin
I am trying to install AWS SAM Cli on my Mac because I am trying to learn the AWS services. But I have installed the AWS cli successful using bundle. But when I tried to install the AWS SAM Cli as well. But it is not working. This is what I have done so far.
Run this command
pip install --user aws-sam-cli
Everything went fine.
Then I opened and edited the ~/.bash_profile. This is the content of the .bash_profile
export PATH=/Applications/MAMP/bin/php/php7.2.7/bin:$PATH
# Find your Python User Base path (where Python --user will install packages/scripts)
$ USER_BASE_PATH=$(python -m site --user-base)
# Update your preferred shell configuration
-- Standard bash --> ~/.bash_profile
-- ZSH --> ~/.zshrc
export PATH=$PATH:$USER_BASE_PATH/bin
Then I closed the terminal and run sam --version.
It is saying command not found. What is wrong with my installation?
The now recommended way to install SAM CLI is to use brew and honestly it's way better, saves you a lot of headaches, like the one you're facing now. See these instructions for details.
As a starting point to making my own app that uses meanjs, I went to the meanjs website and used their yeomen generator to create the template/sample app. Following the instructions getting the sample application running out of the box on my local desktop machine worked within minutes. To complete the exercise I tried to deploy the sample app to an AWS/EC2 instance before making any changes to it. I have used the command line deployment tools in the past and liked it. Also it is nice how now you can just select an EC2 Linux instance with node and npm already installed and ready.
After checking the sample into git, I run "git aws.push" to deploy the app.
The problem is in the package.json the line:
"postinstall": "bower install --config.interactive=false"
In the eb-activity.log:
npm WARN cannot run in wd meansample#0.0.1 bower install --config.interactive=false (wd=/tmp/deployment/application)
The result is that AngularJS ends up not getting installed in /public/lib.
First thing I tried was giving the full path in the package.json file: node_modules/bower/bin/bower. This didn't help and results in the same error. Also noting that other commands like "grunt" don't need the full path specified in the package.json and they work.
I don't understand enough of the black box magic that aws.push does to understand why this error is happening. For example what user does it run as? What permissions does that user have? what options if any does it use when it runs npm install?
I did figure out a work-around, but it adds a lot of extra steps that shouldn't be required if aws.push was able to run bower install directly. Basically I can manually run the bower install in the ssh client connected to my EC2 instance, set the owner/group on the installed files, and restart the server.
Work-around steps:
1) On local command prompt run git aws.push. Wait for unsuccessfully deployment to finish.
2) Connect ssh client to EC2 instance. From the command prompt:
cd /var/app/current
/* NOTE: if I don't use sudo the ec2user I am logged in as does not have permission to create /public/lib needed to install AngularJS into*/
sudo node_modules/bower/bin/bower install --config.interactive=false --allow-root
/* NOTE: just changing the owner and group to match the same as the other files that aws.push deployed */
sudo chown -R nodejs public/lib
sudo chgrp -R nodejs public/lib
From AWS dashboard, select the correct EC2 instance, Action = Restart App Server(s)
Now AngularJS is install and the sample app works.
How do I eliminate the extra steps and make it so aws.push can do the bower install successfully?
I have experienced the same problem when trying to publish my nodejs app in a private server running CentOs using root user. The same error is fired by "postinstall": "./node_modules/bower/bin/bower install" in my package.json file so the only solution that was working for me is to use both options to avoid the error:
1: use --allow-root option for bower install command
"postinstall": "./node_modules/bower/bin/bower --allow-root install"
2: use --unsafe-perm option for npm install command
npm install --unsafe-perm