amazon-archives / awsmobile-cli

CLI experience for Frontend developers in the JavaScript ecosystem.
Apache License 2.0
142 stars 35 forks source link

"frontend start command execution error" #169

Closed oxbits closed 5 years ago

oxbits commented 5 years ago

i'm on macos 10.13.5

i run "awsmobile run" and get the following result

##############

$ awsmobile run

checking the backend contents generating backend project content done backend build artifacts are saved at: /Users/ox/_ws/aws_appsync/nader_dabit_reactjs/recipe-web-appsync/awsmobilejs/.awsmobile/backend-build

preparing for backend project update: Recipe Demo done

updating backend project: Recipe Demo

Successfully updated the backend awsmobile project: Recipe Demo

retrieving the latest backend awsmobile project information awsmobile project's details logged at: awsmobilejs/#current-backend-info/backend-details.json awsmobile project's specifications logged at: awsmobilejs/#current-backend-info/mobile-hub-project.yml awsmobile project's access information logged at: awsmobilejs/#current-backend-info/aws-exports.js awsmobile project's access information copied to: src/aws-exports.js contents in #current-backend-info/ is synchronized with the latest in the aws cloud

executing frontend start command ... frontend start command execution error: { Error: spawn npm.cmd ENOENT at _errnoException (util.js:1024: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._tickDomainCallback (internal/process/next_tick.js:218:9) code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn npm.cmd', path: 'npm.cmd', spawnargs: [ 'run-script', 'start' ] }

kaustavghosh06 commented 5 years ago

What time of project are you running? Is it a react app?

UnleashedMind commented 5 years ago

please check the StartCommand by running awsmobile configure project -l try to execute that command and see if it has issues. the awsmobile-cli only spawns a child process to execute that start command. that error is from the start command, and ENOENT usually mean the command can't be found, it's usually because the path to the executable is not in the PATH environment variable.

dan1elhughes commented 5 years ago

I've just had the same problem @oxbits - the CLI is attempting to run npm.cmd (which is the windows npm binary) and not finding it as you're on a Mac. Was this project set up on a Windows box, and now moved over to the Mac?

Here's what worked for me; I changed the BuildCommand and StartCommand in awsmobilejs/.awsmobile/info/project-config.json so that instead of referring to npm.cmd they refer to npm directly.

UnleashedMind commented 5 years ago

The cli won't try to run 'npm.cmd' if it is not explicitly set in the build command, one scenario that can lead to this is when the project was originally init'ed on a windows machine, and then a team member pulled it from the repo into a mac machine, then he needs to change that command. You can change the configurations by executing awsmobile configure project

oxbits commented 5 years ago

thank you all for the feedback, i'm very new to all this. i was working on getting this codebase up and running: https://github.com/Jeyloh/recipe-web-appsync never got it to work, but i was able to go back to this original video, got past some bumps, and got it to work (https://www.youtube.com/watch?v=qNkkPoq9D3k) thank you

dylan-westbury commented 5 years ago

For me, I was missing a library (angular cli) that was being executed in the project-config.json

npm install -g @angular/cli

kpjofficial commented 5 years ago

This worked for me as well. I was using the example for chat app using app sync and was facing the error at amplify serve. I also tried with ng serve, but no command found for that as well. Thank you.

For me, I was missing a library (angular cli) that was being executed in the project-config.json

npm install -g @angular/cli