Amplify-js: Module `axios` does not exist in the Haste module map or in these directories

Created on 28 Jan 2019  路  15Comments  路  Source: aws-amplify/amplify-js

Describe the bug
after installing CocoaPod, it is giving me this error when I run command react-native run-ios. earlier it was working fine.
To Reproduce
Steps to reproduce the behavior:
simply run react-native run-ios

Expected behavior
it should run without any error

Desktop (please complete the following information):

  • macOS hight Sierra
  • Chrome Browser for debugging

Smartphone (please complete the following information):

  • Simulator: [e.g. iPhoneX]
  • OS: iOS11.4

package.json
{
"name": "VikingHealth",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"aws-amplify": "^1.0.11",
"aws-amplify-react": "^2.0.1",
"aws-amplify-react-native": "^2.0.1",
"aws-appsync": "^1.7.0",
"aws-appsync-react": "^1.2.5",
"aws-sdk": "^2.353.0",
"d3-shape": "^1.2.2",
"es6-symbol": "^3.1.1",
"google-libphonenumber": "^3.1.14",
"graphql-tag": "^2.10.0",
"i": "^0.3.6",
"install": "^0.12.2",
"link": "^0.1.5",
"lodash": "^4.17.11",
"mobx": "^4.8.0",
"mobx-react": "^5.0.0",
"moment": "^2.22.2",
"moment-range": "^4.0.1",
"npm": "^6.7.0",
"opentok-react-native": "^0.9.5",
"prop-types": "^15.6.2",
"react": "16.5.0",
"react-apollo": "^2.2.4",
"react-art": "^16.6.0",
"react-native": "^0.57.7",
"react-native-chart-kit": "^1.1.9",
"react-native-circular-progress": "^1.0.1",
"react-native-easy-toast": "^1.1.0",
"react-native-elements": "^1.0.0-beta7",
"react-native-i18n": "^2.0.15",
"react-native-keyboard-aware-scroll-view": "^0.7.2",
"react-native-linear-gradient": "^2.4.2",
"react-native-multiple-picker": "0.0.21",
"react-native-parallax-header": "^1.0.6",
"react-native-phone-input": "^0.2.1",
"react-native-popup-dialog": "^0.16.3",
"react-native-progress": "^3.5.0",
"react-native-progress-circle": "^2.0.1",
"react-native-segmented-control-tab": "^3.3.1",
"react-native-simple-dialogs": "^0.4.1",
"react-native-slider": "^0.11.0",
"react-native-svg": "^6.4.1",
"react-native-svg-charts": "^5.2.0",
"react-native-triangle": "0.0.9",
"react-native-vector-icons": "^6.1.0",
"react-native-video": "^4.2.0",
"react-navigation": "^2.14.2",
"rn-viewpager": "^1.2.9"
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.1.2",
"@babel/runtime": "^7.1.2",
"babel-jest": "23.6.0",
"babel-plugin-transform-remove-console": "^6.9.4",
"eslint-config-rallycoding": "^3.2.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "^0.48.3",
"react-test-renderer": "16.5.0"
},
"jest": {
"preset": "react-native"
},
"rnpm": {
"assets": [
"./assets/fonts/"
]
}
}

Additional context
error: bundling failed: Error: Unable to resolve module axios from /Users/tarun/Desktop/projects/quovantis-projects/Viking-health-Master/VikingHealth/node_modules/@aws-amplify/api/lib/RestClient.js: Module axios does not exist in the Haste module map or in these directories:
/Users/tarun/Desktop/projects/quovantis-projects/Viking-health-Master/VikingHealth/node_modules/@aws-amplify/api/node_modules

This might be related to https://github.com/facebook/react-native/issues/4968
To resolve try the following:

  1. Clear watchman watches: watchman watch-del-all.
  2. Delete the node_modules folder: rm -rf node_modules && npm install.
  3. Reset Metro Bundler cache: rm -rf /tmp/metro-bundler-cache-* or npm start -- --reset-cache.
  4. Remove haste cache: rm -rf /tmp/haste-map-react-native-packager-*.
    at ModuleResolver.resolveDependency (/Users/tarun/Desktop/projects/quovantis-projects/Viking-health-Master/VikingHealth/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:139:15)
    at ResolutionRequest.resolveDependency (/Users/tarun/Desktop/projects/quovantis-projects/Viking-health-Master/VikingHealth/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:49:18)
    at DependencyGraph.resolveDependency (/Users/tarun/Desktop/projects/quovantis-projects/Viking-health-Master/VikingHealth/node_modules/metro/src/node-haste/DependencyGraph.js:218:16)
    at Object.resolve (/Users/tarun/Desktop/projects/quovantis-projects/Viking-health-Master/VikingHealth/node_modules/metro/src/lib/transformHelpers.js:141:30)
    at dependencies.map.result (/Users/tarun/Desktop/projects/quovantis-projects/Viking-health-Master/VikingHealth/node_modules/metro/src/DeltaBundler/traverseDependencies.js:373:31)
    at Array.map ()
    at resolveDependencies (/Users/tarun/Desktop/projects/quovantis-projects/Viking-health-Master/VikingHealth/node_modules/metro/src/DeltaBundler/traverseDependencies.js:369:18)
    at /Users/tarun/Desktop/projects/quovantis-projects/Viking-health-Master/VikingHealth/node_modules/metro/src/DeltaBundler/traverseDependencies.js:188:33
    at Generator.next ()
    at step (/Users/tarun/Desktop/projects/quovantis-projects/Viking-health-Master/VikingHealth/node_modules/metro/src/DeltaBundler/traverseDependencies.js:298:30)
    BUNDLE [ios, dev] ../../index.js 24.3% (347/738)::1 - - [28/Jan/2019:02:14:52 +0000] "GET /index.bundle?platform=ios&dev=true&minify=false HTTP/1.1" 200 - "-" "VikingHealth/1 CFNetwork/901.1 Darwin/17.7.0"
    BUNDLE [ios, dev] ../../index.js 99.4% (2037/2043)^[[B^[[B
API React Native investigating pending-close-response-required

Most helpful comment

I was able to solve it after remove the file rn-cli.js that I created to solve another problem

All 15 comments

I am struggling with the same error - the suggestion to resolve the issue does not rectify it unfortunately

@matt-paul and @tarunmehta-quovantis did you got any solution?

Same error here

+1

same here

I was able to solve it after remove the file rn-cli.js that I created to solve another problem

I deleted rn-cli.js (if you have it in your root folder).

add
pod 'React', :path => '../node_modules/react-native'
pod 'yoga', :path => '../node_modules/react-native/ReactCommon/yoga'
to your Podfile located in your ios folder.

Then run cd ios && rm -rf Pods && pod install

Same issue.
What I can't explained is that it properly build using Xcode but it doesn't build using react-native run-ios...

you dont have any error on android ?

I have similar issue. any updates?

same issue for me. any resolution? Thanks.

Same issue on android, but I have the same issue on import any other dependencies.

I solved this problem by adding the dependencies by SU instead of SUDO in Ubuntu

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

callmekatootie picture callmekatootie  路  3Comments

guanzo picture guanzo  路  3Comments

shinnapatthesix picture shinnapatthesix  路  3Comments

rygo6 picture rygo6  路  3Comments

benevolentprof picture benevolentprof  路  3Comments