amplify-cli icon indicating copy to clipboard operation
amplify-cli copied to clipboard

'amplify configure' not working on windows (cmd.exe)

Open mohitsriv opened this issue 8 years ago • 28 comments

Do you want to request a feature or report a bug? Bug

What is the current behavior? Running 'amplify configure' returns "Error: you are not working inside a valid amplify project"

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.

  1. Create an empty folder
  2. Run 'amplify configure'
  3. See the above error

What is the expected behavior? It should work properly on an empty folder. It should not require an amplify project.

Which versions of Amplify CLI, and which OS are affected by this issue? Did this work in previous versions? npm installed the latest version of the CLI as of 8/24/2018. Running on Windows 10.

mohitsriv avatar Aug 24 '18 19:08 mohitsriv

@mohitsriv Did you have any beta CLI builds installed from before?

kaustavghosh06 avatar Aug 24 '18 21:08 kaustavghosh06

I'm seeing the same issue (also applied to Powershell). As the amplify CLI tool is installed globally, I don't think the empty folder is necessary for this. It should just simply work anywhere.

I'm seeing it on a fresh install of Windows 10 with no previous betas installed.

Versions: node v10.9.0 npm v6.2.0 Windows 10 Pro (fresh install)

Error: you are not working inside a valid amplify project
    at getAmplifyDirPath (MY_NODE_DIRECTORY\node_modules\@aws-amplify\cli\src\extensions\amplify-helpers\path-manager.js:57:9)
    at getDotConfigDirPath (MY_NODE_DIRECTORY\node_modules\@aws-amplify\cli\src\extensions\amplify-helpers\path-manager.js:63:5)
    at Object.getProjectConfigFilePath (MY_NODE_DIRECTORY\node_modules\@aws-amplify\cli\src\extensions\amplify-helpers\path-manager.js:100:5)
    at Object.getProjectDetails (MY_NODE_DIRECTORY\node_modules\@aws-amplify\cli\src\extensions\amplify-helpers\get-project-details.js:5:45)
    at Command.run (MY_NODE_DIRECTORY\node_modules\@aws-amplify\cli\node_modules\amplify-category-hosting\commands\hosting\configure.js:7:39)
    at Runtime.<anonymous> (MY_NODE_DIRECTORY\node_modules\@aws-amplify\cli\node_modules\gluegun\build\runtime\run.js:90:58)
    at step (MY_NODE_DIRECTORY\node_modules\@aws-amplify\cli\node_modules\gluegun\build\runtime\run.js:32:23)
    at Object.next (MY_NODE_DIRECTORY\node_modules\@aws-amplify\cli\node_modules\gluegun\build\runtime\run.js:13:53)

mwarger avatar Aug 25 '18 03:08 mwarger

I've uninstalled the npm module and installed from source. Confirmed that the updated messages is now displaying, but I have the same issue after running amplify configure in a random directory.

C:\dev\amplify-cli\packages\amplify-cli\node_modules\gluegun\build\index.js:13
    throw up;
    ^

Error: You are not working inside a valid amplify project.
Use 'amplify init' in the root of your app directory to initialize your project with Amplify
    at getAmplifyDirPath (C:\dev\amplify-cli\packages\amplify-cli\src\extensions\amplify-helpers\path-manager.js:58:9)
    at getDotConfigDirPath (C:\dev\amplify-cli\packages\amplify-cli\src\extensions\amplify-helpers\path-manager.js:64:5)
    at Object.getProjectConfigFilePath (C:\dev\amplify-cli\packages\amplify-cli\src\extensions\amplify-helpers\path-manager.js:101:5)
    at Object.getProjectDetails (C:\dev\amplify-cli\packages\amplify-cli\src\extensions\amplify-helpers\get-project-details.js:5:45)
    at Command.run (C:\dev\amplify-cli\packages\amplify-category-hosting\commands\hosting\configure.js:7:39)
    at Runtime.<anonymous> (C:\dev\amplify-cli\packages\amplify-cli\node_modules\gluegun\build\runtime\run.js:90:58)
    at step (C:\dev\amplify-cli\packages\amplify-cli\node_modules\gluegun\build\runtime\run.js:32:23)
    at Object.next (C:\dev\amplify-cli\packages\amplify-cli\node_modules\gluegun\build\runtime\run.js:13:53)
    at C:\dev\amplify-cli\packages\amplify-cli\node_modules\gluegun\build\runtime\run.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (C:\dev\amplify-cli\packages\amplify-cli\node_modules\gluegun\build\runtime\run.js:3:12)
    at Runtime.run (C:\dev\amplify-cli\packages\amplify-cli\node_modules\gluegun\build\runtime\run.js:51:12)
    at Object.run (C:\dev\amplify-cli\packages\amplify-cli\src\cli.js:20:29)
    at Object.<anonymous> (C:\dev\amplify-cli\packages\amplify-cli\bin\amplify:3:23)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)

mwarger avatar Aug 25 '18 15:08 mwarger

Quick note, since I mentioned running configure on Windows in a different ticket - I do get this issue if I run in an empty directory. However, if I run init first, then configure, it runs fine.

ericathegreat avatar Aug 27 '18 05:08 ericathegreat

@mwarger @ericathegreat @mohitsriv we’re seeing some anomalous behavior on windows due to the filesystem. We’ll be figuring out a solution in the next couple of days and get back to you on this thread.

kaustavghosh06 avatar Aug 27 '18 05:08 kaustavghosh06

I have the same issue with amplify configure

rlopmar avatar Aug 27 '18 11:08 rlopmar

Windows 10 here

"amplify configure" gives "Error: You are not working inside a valid amplify project."

"amplify init" asks me to choose a Default editor. I select "Visual Studio Code. It then prompts for the type of app that you're building but instead of allowing selecting, I get thrown back to the powershell prompt. (ticket #34 opened for this issue as it seems to be different)

Trying "amplify configure" after the failed "amplify init" results in the same "You are not working inside a valid Amplify project" error.

bradthurber avatar Aug 27 '18 12:08 bradthurber

I thought I would try the Windows Subsystem on Linux (WSL) but when I run aws configure:

root@DESKTOP-LU92RCU:/mnt/c/users/bradt/Documents/Cs/react/amplif# amplify configure
Follow these steps to set up access to your AWS account:

Sign in to your AWS administrator account:
https://console.aws.amazon.com/
Press Enter to continue
2018-08-27T12:32:30.673Z - error: uncaughtException: spawn cmd.exe ENOENT date=Mon Aug 27 2018 08:32:30 GMT-0400 (DST), pid=59, uid=0, gid=0, cwd=/mnt/c/users/bradt/Documents/Cs/react/amplif, execPath=/usr/bin/node, version=v8.11.4, argv=[/usr/bin/node, /usr/bin/amplify, configure], rss=116506624, heapTotal=94609408, heapUsed=64301088, external=669752, loadavg=[0.5185546875, 0.57763671875, 0.5859375], uptime=1067, trace=[column=11, file=util.js, function=_errnoException, line=992, method=null, native=false, column=19, file=internal/child_process.js, function=Process.ChildProcess._handle.onexit, line=190, method=onexit, native=false, column=16, file=internal/child_process.js, function=onErrorNT, line=372, method=null, native=false, column=11, file=internal/process/next_tick.js, function=_combinedTickCallback, line=138, method=null, native=false, column=9, file=internal/process/next_tick.js, function=process._tickCallback, line=180, method=_tickCallback, native=false, column=11, file=module.js, function=Module.runMain, line=695, method=runMain, native=false, column=16, file=bootstrap_node.js, function=startup, line=191, method=null, native=false, column=3, file=bootstrap_node.js, function=null, line=612, method=null, native=false], stack=[Error: spawn cmd.exe ENOENT,     at _errnoException (util.js:992:11),     at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19),     at onErrorNT (internal/child_process.js:372:16),     at _combinedTickCallback (internal/process/next_tick.js:138:11),     at process._tickCallback (internal/process/next_tick.js:180:9),     at Function.Module.runMain (module.js:695:11),     at startup (bootstrap_node.js:191:16),     at bootstrap_node.js:612:3]

bradthurber avatar Aug 27 '18 12:08 bradthurber

@bradthurber I see the same amplify init behavior as well. I believe it likely fails because it's not configured, but I can't prove that.

@kaustavghosh06 - is there a verbose mode for the CLI so we can get output? Are logs saved somewhere? Would be happy to provide any assistance.

@bradthurber again - I had a hell of a time getting amplify to work after installing it on WSL. I had to reinstall once and then it worked. At that point, parts of the dependencies for Amplify were all referencing /mnt/c in their path and would not work any longer in the "regular" windows 10 cmd/powershell. I couldn't figure out how to unlink the npm library so it appeared stuck to WSL even after uninstalling WSL. My lack of deep npm knowledge probably led me astray, but I ended up formatting my system to reset everything (not a big deal, takes 30 minutes). 😞

mwarger avatar Aug 27 '18 13:08 mwarger

Hey guys, so I tried using the CLI with the Windows Linux susbsytem (WSL) on windows and it works fine so far. Highly encourage using WSL for your Amplify project development. We have updated our main README with the following.


If you're using Windows, the CLI currently supports [Windows Subsystem for Linux](https://docs.microsoft.com/en-us/windows/wsl/install-win10).

In the meanwhile we're trying to figure out the rootcause of the erroneous behavior of the CLI with the windows filesystem.

kaustavghosh06 avatar Aug 27 '18 23:08 kaustavghosh06

Just an FYI - if you want to run the commands in VSCode on windows or another powershell window, you can prefix them with wsl. So amplify add hosting would become wsl amplify add hosting. This will forward them to WSL and run them using the amplify install in the linux system.

mwarger avatar Aug 28 '18 03:08 mwarger

This issue should be fixed with the latest version of the CLI. Feel free to re-open if the problem still persists.

kaustavghosh06 avatar Sep 20 '18 17:09 kaustavghosh06

Unfortunatly it is not solved under Windows 10

G:\Code\temp\myapp>node -v v10.11.0

G:\Code\temp\myapp>npm -v 6.4.1

G:\Code\temp\myapp>amplify init Note: It is recommended to run this command from the root of your app directory ? Choose your default editor: Sublime Text ? Choose the type of app that you're building (Use arrow keys) android ios

javascript_

G:\Code\temp\myapp>amplify add auth C:\Users\Grid\AppData\Roaming\npm\node_modules@aws-amplify\cli\node_modules\gluegun\build\index.js:13 throw up; ^

Error: You are not working inside a valid amplify project. Use 'amplify init' in the root of your app directory to initialize your project with Amplify at getAmplifyDirPath (C:\Users\Grid\AppData\Roaming\npm\node_modules@aws-amplify\cli\src\extensions\amplify-helpers\path-manager.js:57:9) at getDotConfigDirPath (C:\Users\Grid\AppData\Roaming\npm\node_modules@aws-amplify\cli\src\extensions\amplify-helpers\path-manager.js:63:5) at Object.getProjectConfigFilePath (C:\Users\Grid\AppData\Roaming\npm\node_modules@aws-amplify\cli\src\extensions\amplify-helpers\path-manager.js:99:5) at Object.getProjectDetails (C:\Users\Grid\AppData\Roaming\npm\node_modules@aws-amplify\cli\src\extensions\amplify-helpers\get-project-details.js:5:45) at run (C:\Users\Grid\AppData\Roaming\npm\node_modules@aws-amplify\cli\node_modules\amplify-category-auth\commands\auth\enable.js:15:34) at Command.run (C:\Users\Grid\AppData\Roaming\npm\node_modules@aws-amplify\cli\node_modules\amplify-category-auth\commands\auth.js:9:16) at Runtime. (C:\Users\Grid\AppData\Roaming\npm\node_modules@aws-amplify\cli\node_modules\gluegun\build\runtime\run.js:90:58) at step (C:\Users\Grid\AppData\Roaming\npm\node_modules@aws-amplify\cli\node_modules\gluegun\build\runtime\run.js:32:23) at Object.next (C:\Users\Grid\AppData\Roaming\npm\node_modules@aws-amplify\cli\node_modules\gluegun\build\runtime\run.js:13:53) at C:\Users\Grid\AppData\Roaming\npm\node_modules@aws-amplify\cli\node_modules\gluegun\build\runtime\run.js:7:71

gridknight avatar Sep 29 '18 19:09 gridknight

@gridknight Which version of the CLI are you running? You can run ‘amplify -v’ to check it.

kaustavghosh06 avatar Sep 29 '18 19:09 kaustavghosh06

@kaustavghosh06 I am using 0.1.24

G:\Code\temp\myapp>amplify -v 0.1.24

Tried npm install -g @aws-amplify/cli Has not changed anything.

amplify configure works without a problem. Anything else seams to be not working

gridknight avatar Sep 29 '18 19:09 gridknight

I am running version 0.1.27

When I do amplify configure it seems to work ok. Then I do amplify init and I get a similar problem where I am not allowed to chose android or ios. Then finally, get init is still having the same problem.

Just wondering if there is a fix as of 10/3

Thanks

TylerKann avatar Oct 04 '18 06:10 TylerKann

Same here as @TylerKann & @bradthurber etc. Also running version 0.1.27 on Windows 10 Any updates?

ReadyProgrammer1 avatar Oct 15 '18 17:10 ReadyProgrammer1

One of my pc's is running 0.1.29 and it worked fine. another one can't choose the type of app i'm building because it dumps to the command line with no error message.

stevegula avatar Oct 30 '18 02:10 stevegula

Same issue as @stevegula using PowerShell and:

❯ amplify -v
0.1.31

nickcox avatar Nov 03 '18 08:11 nickcox

We published a new version of the CLI to npm, version -> 0.1.32 with fixes for windows. Feel free to re-open the issue if the problem still persists.

kaustavghosh06 avatar Nov 05 '18 20:11 kaustavghosh06