Skip to content

Need example for browserify with npm module #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
funkytaco opened this issue Jan 15, 2015 · 3 comments
Closed

Need example for browserify with npm module #1

funkytaco opened this issue Jan 15, 2015 · 3 comments

Comments

@funkytaco
Copy link

I don't know why this module isn't working when I try to use it with Angular and npm with Browserify. I can install any other module, require it in app.js, and it works. Here's my package.json:

{
  "name": "test",
  "version": "0.0.0",
  "description": "## Development \tnpm install -g bower json-proxy \tbower install",
  "main": "Gruntfile.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "None",
  "license": "ISC",
  "dependencies": {
    "angular": "1.2.23",
    "angular-bootstrap": "^0.12.0",
    "angular-module-resource": "1.2.19",
    "angular-resource": "0.1.1",
    "angular-route": "1.2.17-build.163.1",
    "angular-treemendous": "^0.2.3",
    "bootstrap": "^3.2.0",
    "gulp": "^3.8.7",
    "gulp-browserify": "^0.5.1",
    "gulp-concat": "^2.3.4",
    "gulp-jshint": "^1.9.0",
    "gulp-load-plugins": "^0.6.0",
    "gulp-webserver": "^0.7.0",
    "morgan": "^1.5.1"
  },
  "devDependencies": {
    "chai": "^1.9.1",
    "chai-as-promised": "^4.1.1",
    "mocha": "^1.21.4",
    "protractor": "^1.1.1"
  }
}

Here's app.js:

  var ngTreemendous = require('angular-treemendous');
  var app = angular.module('app', ['ngRoute', 'ngResource', 'ui.bootstrap','treemendous']);

Gulp browserify:

    gulp.task('browserify', ['lint', 'templates'], function() {
      var jsFiles = ['js/app.js'];
      gulp.src(jsFiles)
        .pipe(plugins.browserify({debug: true, insertGlobals: true}))
        .pipe(plugins.concat('bundle.js'))
        .pipe(gulp.dest(dest));
    });

I get an error saying:
Error: module "angular-treemendous" not found from "/Users/myuser/my-webapp/js/fake_84520517.js"

The module is definitely installed. I've had two co-workers review and we can't find the problem.

@wtfribley
Copy link
Owner

Oops -- package.json was out of date. The "main" field should be "angular-treemendous.js"

I have limited internet access at the moment... I quickly committed the change, but it may take me a couple days to bump the version and publish to npm. In the meantime, just go in and change the "main" field in the angular-treemendous package.json and see if that fixes it...

@paulpflug
Copy link

+1 for a bump

@wtfribley
Copy link
Owner

Closing in favor of #2

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

No branches or pull requests

3 participants