Skip to content
This repository has been archived by the owner on Feb 7, 2020. It is now read-only.

Following Get Started tutorial fails #10

Closed
roosi opened this issue Dec 11, 2017 · 14 comments
Closed

Following Get Started tutorial fails #10

roosi opened this issue Dec 11, 2017 · 14 comments

Comments

@roosi
Copy link

roosi commented Dec 11, 2017

Following Get Started tutorial ends failure when running awsmobile run

retrieving the latest backend awsmobile project information
awsmobile project's details logged at: awsmobilejs\#current-backend-info\backend-details.json
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
awsmobile project's specifications logged at: awsmobilejs\#current-backend-info\mobile-hub-project.yml
contents in #current-backend-info/ is synchronized with the latest information in the aws cloud

executing npm install ...
npm install execution error
{ Error: spawn npm ENOENT
    at exports._errnoException (util.js:1020:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:197:32)
    at onErrorNT (internal/child_process.js:376:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickDomainCallback (internal/process/next_tick.js:128:9)
  code: 'ENOENT',
  errno: 'ENOENT',
  syscall: 'spawn npm',
  path: 'npm',
  spawnargs: [ 'install' ] }
>systeminfo | findstr /C:"OS"
OS Name:                   Microsoft Windows 8.1 Enterprise
OS Version:                6.3.9600 N/A Build 9600

>node -v
v6.11.5

>npm -v
3.10.10
@roosi
Copy link
Author

roosi commented Dec 13, 2017

Issue happens only in windows, where tools is unusable. You could check if spawning happens in windows and use 'npm.cmd' instead of 'npm'.

@mlabieniec
Copy link
Contributor

@roosi have you tried with bash on windows? Should be ok here, we currently don't officially have support for windows shell yet.

@elorzafe
Copy link
Contributor

This problem was solved on version 1.0.5 that is published on npm. You only need to update to that version to solve the problem.

@roosi
Copy link
Author

roosi commented Jan 11, 2018

Same thing happens with newer version too.

>awsmobile -V
1.0.7

@SarvagyaS
Copy link

Hi, even i am having the same issue.
did u find anything ?

@michaellashinsky
Copy link

michaellashinsky commented Jan 11, 2018

This is a continuation of the issues I had in 1.0.6 Monday. I updated to 1.0.7 and this is new

My environment is:
Windows 10
nodejs 9.4.0
npm 5.6.0
awsmobile-cli 1.0.7

This is what I get when I run awsmobile run in the root of the React Restaurant starter kit:

$ awsmobile run

building backend
   building cloud-api
      zipping ReactSample
   generating backend project content
   backend project content generation successful
done, build artifacts are saved at:
C:\sandbox\personal\aws-mobile-react-sample\awsmobilejs\.awsmobile\backend-build

preparing for backend project update: react-sample
   uploading ReactSample-20180111151851.zip
   upload Successful  ReactSample-20180111151851.zip
done

updating backend project: react-sample
awsmobile update api call returned with no error
waiting for the formation of cloud-api to complete
cloud-api update finished with status code: UPDATE_COMPLETE

Successfully updated the backend awsmobile project: react-sample

retrieving the latest backend awsmobile project information
awsmobile project's details logged at: awsmobilejs\#current-backend-info\backend-details.json
awsmobile project's access information logged at: awsmobilejs\#current-backend-info\aws-exports.js
awsmobile project's specifications logged at: awsmobilejs\#current-backend-info\mobile-hub-project.yml
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 ENOENT
    at _errnoException (util.js:1003:13)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:201:19)
    at onErrorNT (internal/child_process.js:389:16)
    at process._tickCallback (internal/process/next_tick.js:152:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn npm',
  path: 'npm',
  spawnargs: [ 'run-script', 'start' ] }


320000082@YY105583 MINGW64 /c/sandbox/personal/aws-mobile-react-sample (master)
$

@ysfyong
Copy link

ysfyong commented Jan 12, 2018

I am using npm command prompt. Still the same issue.
Window 10
npm 5.6.0
awsmobile-cli 1.0.7

After run awsmobile run:
executing frontend start command ...
frontend start command execution error:
{ Error: spawn npm ENOENT
at _errnoException (util.js:1022: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',
path: 'npm',
spawnargs: [ 'start' ] }

@chessIthaca
Copy link

The issue is that windows 10 can not resolve npm.cmd ... I don't have a solution for it though.

@ysfyong
Copy link

ysfyong commented Jan 15, 2018

@chessIthaca
I followed the steps from pull request. Using npm.cmd to run local test and it works. Below are the steps.

  1. Open node.js command prompt.
  2. Run awsmobile init at aws-mobile-react-sample\client. Then set all default value.
    ? Where is your project's source directory: src
    ? Where is your project's distribution directory that stores build artifacts: build
    ? What is your project's build command: npm run-script build
    ? What is your project's start command for local test run: npm run-script start
  3. Run npm.cmd install at aws-mobile-react-sample\client
  4. Run npm.cmd run-script start at aws-mobile-react-sample\client
  5. Project is running at http://localhost:8080/.

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

@michaellashinsky
Copy link

michaellashinsky commented Jan 15, 2018

@ysfyong thanks for this. It worked for me. I shortened up the commands a bit and ran them like this:

First open cmd/powershell in app-dir/client
Executed awsmobile init in app-dir/client and accepted all defaults
Executed npm i in app-dir/client
Executed npm start in app-dir/client
Opened a browser and pointed to http://localhost:8080 and viewed the running app

@michaellashinsky
Copy link

michaellashinsky commented Jan 15, 2018

@chessIthaca I don't think its Windows 10 not resolving npm.cmd. I can call npm.cmd in a new cmd/powershell window it complains that I didn't issue a command for npm to execute when I called it. I believe that its rooted at the child_process.spawn not getting PATHEXT passed to it, or being passed in empty so when it gets npm.cmd it goes off into the weeds.

@michaellashinsky
Copy link

To follow up one work around proposed here is to use cross-spawn: nodejs/node#6671

@abhijagtap73
Copy link

I used npm.cmd run-script build and npm.cmd run-script start it works for me

@smakintel
Copy link

I'm using windows 10, changing project-config.json (awsmobilejs/.awsmobile/info)

changed npm to npm.cmd as below worked for me

{
"SourceDir": "/",
"DistributionDir": "build",
"BuildCommand": "npm.cmd run-script build",
"StartCommand": "npm.cmd run-script start"
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

9 participants