Skip to content

When requiring outside library, transform process hangs #2949

Closed
@criticerz

Description

@criticerz

This is my index.io.js file:

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 */
'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
} = React;

var LayerAPI = require('layer-api');

var ClutchChat = React.createClass({
  render: function() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Welcome to React Native!
        </Text>
        <Text style={styles.instructions}>
          To get started, edit index.ios.js
        </Text>
        <Text style={styles.instructions}>
          Press Cmd+R to reload,{'\n'}
          Cmd+D or shake for dev menu
        </Text>
      </View>
    );
  }
});

var styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

AppRegistry.registerComponent('ClutchChat', () => ClutchChat);

and my package.json file:

{
  "name": "ClutchChat",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node_modules/react-native/packager/packager.sh"
  },
  "dependencies": {
    "layer-api": "^1.0.3",
    "react-native": "^0.11.0"
  }
}

Unfortunately, when I build the app the following happens in the console:

React packager ready.

[5:06:01 PM] <START> Building Dependency Graph
[5:06:01 PM] <START> Crawling File System
Launching Dev Tools...
[5:06:03 PM] <START> request:/index.ios.bundle
[5:06:03 PM] <START> find dependencies
[5:06:03 PM] <START> request:/index.ios.bundle
tab id 1248 of window id 54


WARN: not opened
[5:06:12 PM] <END>   Crawling File System (11218ms)
[5:06:12 PM] <START> Building in-memory fs for JavaScript
[5:06:12 PM] <END>   Building in-memory fs for JavaScript (727ms)
[5:06:12 PM] <START> Building in-memory fs for Assets
[5:06:13 PM] <END>   Building in-memory fs for Assets (641ms)
[5:06:13 PM] <START> Building Haste Map
[5:06:13 PM] <START> Building (deprecated) Asset Map
[5:06:14 PM] <END>   Building (deprecated) Asset Map (172ms)
Unable to resolve module util from /Users/alain/Sites/ClutchChat/node_modules/layer-api/lib/utils.js
Unable to resolve module https from /Users/alain/Sites/ClutchChat/node_modules/layer-api/lib/request.js
Unable to resolve module util from /Users/alain/Sites/ClutchChat/node_modules/layer-api/lib/errors.js
transforming [======================================= ] 98% 309/316[5:06:14 PM] <END>   Building Haste Map (526ms)
[5:06:14 PM] <END>   Building Dependency Graph (13113ms)
[5:06:14 PM] <END>   find dependencies (10647ms)
[5:06:14 PM] <START> transform
transforming [======================================= ] 98% 310/316

And it just hangs there forever. Notice that if I take out the var LayerAPI = require('layer-api'); line it works fine.

Any ideas why that package is causing trouble? I tried another external package and the same thing happened. I made sure to install them using npm install layer-api --save

I'm using React-Native v0.11, Node v4.0.0 & npm v2.14.2.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions