Baseline-JS / core

Baseline Core - Serverless First Framework
https://baselinejs.com
MIT License
41 stars 3 forks source link

'.' is not recognized as an internal or external command on Windows 11 #6

Open timofeysie opened 5 days ago

timofeysie commented 5 days ago

After getting everything setup with AWS and running in the cloud, I am looking at the docs to run the app locally.

The first step is to setup AWS credentials profile. However the command fails:

> pnpm run aws:profile

> @baselinejs/core@0.0.9 aws:profile C:\Users\timof\repos\timo\kogs
> ./scripts/setup-aws-profile.sh

'.' is not recognized as an internal or external command,
operable program or batch file.
 ELIFECYCLE  Command failed with exit code 1.

I am on Windows 11 with the following versions:

This happens in a Windows prompt, as well as in the VSCode bash shell command prompt.

I supposed that error was coming from this line in the scripts\setup-aws-profile.sh:

# Sets REGION, APP_NAME, AWS_REGION, AWS_PROFILE
. ./scripts/project-variables.sh

However, updating that to try some variations doesn't fix the issue, and even removing that file doesn't help.

quantimothy commented 4 days ago

I'm not sure which command should come first, but pnpm run generate:env:local results in the exact same error.

thomas-nixon-baseline commented 4 days ago

Shell scripts will not work in Windows command prompt. Baseline only works on Windows when using the Windows Subsystem for Linux (for now). I would recommend trying it out

https://learn.microsoft.com/en-us/windows/wsl/install https://learn.microsoft.com/en-us/windows/wsl/tutorials/wsl-vscode

timofeysie commented 2 days ago

Thanks for that @thomas-nixon-baseline.

Since installing WSL creates a blank slate OS, I thought I would include notes here on installing all the development tools needed as per the Baseline docs in case it can help others.

The requirements

Installing Git

sudo apt-get install git
$ git --version
git version 2.34.1

Installing Node with NVM

sudo apt-get install curl build-essential libssl-dev
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
nvm install 20
nvm use 20
node --version
v20.15.0
pnpm -v
9.4.0

Install Java runtime

sudo apt install default-jre
java -version
openjdk version "11.0.23" 2024-04-16
OpenJDK Runtime Environment (build 11.0.23+9-post-Ubuntu-1ubuntu122.04.1)
OpenJDK 64-Bit Server VM (build 11.0.23+9-post-Ubuntu-1ubuntu122.04.1, mixed mode, sharing)

Install jq for extracting Cloudformation outputs

sudo apt-get install jq

Install AWS Command Line Interface

sudo apt-get install awscli
aws --version
aws-cli/1.22.34 Python/3.10.12 Linux/5.15.146.1-microsoft-standard-WSL2 botocore/1.23.34

Current issues

After all this, I see a different error now when trying to setup my AWS profile:

$ pnpm run aws:profile

> @baselinejs/core@0.0.9 aws:profile /mnt/c/Users/timof/repos/timo/kogs
> ./scripts/setup-aws-profile.sh
/usr/bin/env: ‘bash\r’: No such file or directory
 ELIFECYCLE  Command failed.
 WARN   Local package.json exists, but node_modules missing, did you mean to install?

$ npm i
npm notice
npm notice New minor version of npm available! 10.7.0 -> 10.8.1
npm notice Changelog: https://github.com/npm/cli/releases/tag/v10.8.1
npm notice To update run: npm install -g npm@10.8.1
npm notice
npm error code EUNSUPPORTEDPROTOCOL
npm error Unsupported URL Type "workspace:": workspace:1.0.0