Amplify-cli: npx amplify-app "Cannot find module 'amplify-frontend-javascript'"

Created on 30 Jan 2020  Â·  5Comments  Â·  Source: aws-amplify/amplify-cli

Which Category is your question related to?

Amplify CLI, DataStore, React

Amplify CLI Version

4.13.1

What AWS Services are you utilizing?

Amplify: CLI, DataStore

Provide additional details e.g. code snippets

To reproduce:

$ npx create-react-app test --use-npm
$ cd test
$ npx amplify-app

Output from last command:

$ npx amplify-app
npx: installed 94 in 3.502s
✅ Found Amplify CLI version 4.13.1
🎸 Creating base Amplify project
Error: Cannot find module 'amplify-frontend-javascript'
Require stack:
- /home/ubuntu/.npm/_npx/1844/lib/node_modules/amplify-app/src/index.js
- /home/ubuntu/.npm/_npx/1844/lib/node_modules/amplify-app/bin/amplify-app
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:17)
    at Function.Module._load (internal/modules/cjs/loader.js:859:27)
    at Module.require (internal/modules/cjs/loader.js:1028:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at /home/ubuntu/.npm/_npx/1844/lib/node_modules/amplify-app/src/index.js:185:31
    at Array.forEach (<anonymous>)
    at guessPlatform (/home/ubuntu/.npm/_npx/1844/lib/node_modules/amplify-app/src/index.js:184:20)
    at getProjectConfig (/home/ubuntu/.npm/_npx/1844/lib/node_modules/amplify-app/src/index.js:151:51)
    at ChildProcess.<anonymous> (/home/ubuntu/.npm/_npx/1844/lib/node_modules/amplify-app/src/index.js:115:18)
    at ChildProcess.emit (events.js:305:20) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/ubuntu/.npm/_npx/1844/lib/node_modules/amplify-app/src/index.js',
    '/home/ubuntu/.npm/_npx/1844/lib/node_modules/amplify-app/bin/amplify-app'
  ]
}

Seeing the same error on Ubuntu and macOS with node 12.x and 13.x .

Am I missing a step or depenency, or is this a bug? I don't remember hitting this with the latest version in December.

bug pending-response platform

All 5 comments

@chuckatc Is the amplify project created when you run into this?

Do you also run into this if you run npx amplify-app --platform javascript --framework react ?

@nikhname ,

Running it as npx amplify-app --platform javascript --framework react works normally and this demo runs fine: https://github.com/sebsto/amplify-datastore-js-e2e .

Thanks very much for the workaround! Are these options documented anywhere? (--help only shows itself and --version)

Running without args, the amplify dir is created:

amplify
amplify/.config
amplify/.config/project-config.json
amplify/backend
amplify/backend/api
amplify/backend/api/amplifyDatasource
amplify/backend/api/amplifyDatasource/parameters.json
amplify/backend/api/amplifyDatasource/schema.graphql
amplify/backend/api/amplifyDatasource/stacks
amplify/backend/api/amplifyDatasource/stacks/CustomResources.json
amplify/backend/api/amplifyDatasource/transform.conf.json
amplify/backend/backend-config.json

but amplify/.config/project-config.json thinks it's an android project:

{
  "projectName": "amplifyStarter",
  "version": "2.0",
  "frontend": "android",
  "providers": ["awscloudformation"],
  "android": {
    "config": {
      "ResDir": "app/src/main/res"
    }
  }
}

Hi @chuckatc could you send a zip of your project directory to [email protected]? Unfortunately these options are not documented, we will look into adding them.

This commit removed these dependencies:

...
    "amplify-frontend-android": "1.31.0",
    "amplify-frontend-ios": "1.31.0",
    "amplify-frontend-javascript": "1.29.0",
...

Might it be causing the issue?

Was this page helpful?
0 / 5 - 0 ratings