frontend start command execution error on awsmobile

I start encountered this “frontend start command execution error” a few days back when I was working on one Angular4 based project where I used awsmobile-cli to publish my code on AWS Mobile Hub. Although my application was building and running without any error in my local environment.

Later on, I realized that this is NodeJs specific error on windows operating system, which originated from awsmobile-cli. Because when I was publishing my application locally it was working fine but the issue is with awsmobile publish only as shown in below screenshot.


I used below configurations in my awsmobile project-config.json which was the root cause of my error

Project-config.json file

{

"SourceDir": "src",

"DistributionDir": "dist",

"BuildCommand": "ng build --prod",

"StartCommand": "ng serve --aot"

}

 

I replaced above configuration with below and my issue got resolved as on windows you need to use npm.cmd not just ng.

Resolved by adding below code 

{

"SourceDir": "src",

"DistributionDir": "dist",

"BuildCommand": "npm.cmd run-script build",

"StartCommand": "ng serve"

}

There can be multiple origins for spawn ENOENT but you need to understand its root cause. I got one more suggestion on git which is quite interesting and also working for others.

Git Solution 

Start from awsmobile pull request and use npm.cmd to run the local test. Below are the steps

  1. Open a node.js command prompt.
  2. Run awsmobile init at aws-mobile-ease2code-sample\client. Then set all default values
  3. Where is your project’s source directory: src
  4. Where is your project’s distribution directory that stores build artifacts: build
  5. What is your project’s build command: npm run-script build
  6. What is your project’s start command for local test run: npm run-script start
  7. Run npm.cmd install at aws-mobile-ease2code-sample\client
  8. Run npm.cmd run-script start at aws-mobile-ease2code-sample\client
  9. The project is running at http://localhost:8080/.

Launched in the browser and it works for me. Hope it helps.

we are open to your suggestions because it can help us to improve a bit more. ww.ease2code.com

Speak Your Mind

*