I downloaded moment but I'm getting a error on my IOS stimulator

Unable to resolve module moment from /Users/justinj/Documents/myapp/card.js: Module does not exist in the module map or in these directories:

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 packager cache: rm -fr $TMPDIR/react-* or npm start -- --reset-cache.

-[ABI21_0_0RCTBatchedBridge stopLoadingWithError:]
__34-[ABI21_0_0RCTBatchedBridge start]_block_invoke_2

What is your directory structure like? Make sure moment is in your package.json dependencies, then npm install

if you npm install a new module, sometimes you need to do “Restart” in XDE / exp / CRNA to restart the packager/bundler. If you correctly npm installed and you restart, it should pick up the new module.

This how my package.json looks like.
“name”: “myapp”,
“version”: “0.0.0”,
“description”: “Hello Expo!”,
“author”: null,
“private”: true,
“main”: “node_modules/expo/App.js”,
“dependencies”: {
“expo”: “^21.0.0”,
“react”: “16.0.0-alpha.12”,
“react-native”: “https://github.com/expo/react-native/archive/sdk-21.0.2.tar.gz


i’m not sure you installed moment. try doing yarn add moment or npm install --save moment and then restart your project.

I put the command into terminal and received the following error:

npm ERR! code ENOSELF
npm ERR! Refusing to install package with name “moment” under a package
npm ERR! also called “moment”. Did you name your project the same
npm ERR! as the dependency you’re installing?
npm ERR!
npm ERR! For more information, see:
npm ERR! https://docs.npmjs.com/cli/install#limitations-of-npms-install-algorithm

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/justinjohnson/.npm/_logs/2017-10-10T21_40_00_336Z-debug.log

weird. what directory did you run this from?

Looks like card.js is trying to require moment but can’t find it.

I would:

  • make sure you’re using npm 4.6.1
  • following github issue instructions in that order (reset watchman, nuke node_modules, install dependencies, and clear cache)

make sure that moment is in your package.json (doesn’t look like it is right now) and you are in the project directory when running the commands

if that doesn’t work:

  • create a new project using XDE
  • copy your files over to the new project (not node_modules)
  • change to new directory and npm install

let me know what happens

hey @newventurez - you can also call npm list in your project directory to see if moment is installed, and if it isnt, follow what @ccheever said

I did everything you guys mentioned and I’m still receiving the same errors.

I been having this problem for a couple of weeks. What else can show you guys, that would help me resolve this issue.

Hey @newventurez how is it going?

It looks like you made this forum post a while ago with a reference to your moment issue then, 'Moment' Command not found

When you resolved this issue, you said you copied moment into your project directory and used an es6 import like import moment from '/modules/moment',

Can you verify for me that this is true?

Yes Jimmy Lee, I did that but I started my project over. And I tried to install firebase and ran into the same issue that I came across when installing moment. I want to resolve this issue because it seems when I try to install moment and firebase something is going wrong.