Skip to content
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

Should there be a reference to bower_components in node script? #10

Closed
jflasher opened this issue Mar 22, 2015 · 10 comments
Closed

Should there be a reference to bower_components in node script? #10

jflasher opened this issue Mar 22, 2015 · 10 comments

Comments

@jflasher
Copy link

Looks like this was something that was picked up in 0.12.6 but seems to be breaking because it can't be found?

$ node app.js 
module.js:338
    throw err;
          ^
Error: Cannot find module '../bower_components/closure-library/closure/goog/bootstrap/nodejs'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/flasher/workspace/population/node_modules/turf/node_modules/turf-erase/node_modules/jsts/node_modules/javascript.util/dist/javascript.util-node.min.js:42:237)
    at Object.<anonymous> (/Users/flasher/workspace/population/node_modules/turf/node_modules/turf-erase/node_modules/jsts/node_modules/javascript.util/dist/javascript.util-node.min.js:42:339)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

@morganherlocker initially ran into this when trying to use turf.js.

@bjornharrtell
Copy link
Owner

Ouch. Thanks for reporting. Will try to reproduce/fix but is away for a week and some. Tests running with node works though so I'm surprised.

@johnknaack
Copy link

I'm currently seeing the same issue while using the JSTS module.

ERROR in .//jsts//javascript.util/dist/javascript.util-node.min.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../bower_components/closure-library/closure/goog/bootstrap/nodejs in /Users/johnknaack/Desktop/ree-js-demographics-client/node_modules/jsts/node_modules/javascript.util/dist
@ .//jsts//javascript.util/dist/javascript.util-node.min.js 42:236-312

ERROR in .//jsts//javascript.util/dist/javascript.util-node.min.js
Module not found: Error: Cannot resolve 'file' or 'directory' ../deps.js in /Users/johnknaack/Desktop/ree-js-demographics-client/node_modules/jsts/node_modules/javascript.util/dist
@ .//jsts//javascript.util/dist/javascript.util-node.min.js 42:313-334

Let me know if I can provide any other info.

@morganherlocker
Copy link

PR to lock the utils version in JSTS bjornharrtell/jsts#174

@lliss
Copy link

lliss commented Mar 23, 2015

I can confirm that this is happening when using grunt-browserify to include a module that requires jsts.

@Nemo157
Copy link

Nemo157 commented Mar 24, 2015

Happens when simply trying to use javascript.util independently as well:

$ npm install javascript.util
javascript.util@0.12.7 ..\node_modules\javascript.util
$ node
> var u = require('javascript.util');
Error: Cannot find module '../bower_components/closure-library/closure/goog/bootstrap/nodejs'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (D:\sources\node_modules\javascript.util\dist\javascript.util-node.min.js:42:237)
    at Object.<anonymous> (D:\sources\node_modules\javascript.util\dist\javascript.util-node.min.js:42:339)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)

@brianreavis
Copy link

With everyone using bundlers of some sort these days (webpack, browserify, requirejs, etc), could this module be turned to commonjs – removing the need to put out dist files? (which would alleviate this issue)

@jflasher
Copy link
Author

https://docs.npmjs.com/cli/shrinkwrap might also be a solution.

@lliss
Copy link

lliss commented Mar 31, 2015

I don't really feel like shrinkwrap is a good solution in this case. I feel like the usecase there is for custom applications with many dependencies but an npm module should be able to build and run without it.

@bjornharrtell
Copy link
Owner

Ah I see the problem now (didn't quite grasp it before). The minified js in the npm package seem to be dependant on closure-library/closure/goog/bootstrap/nodejs, which I didn't expect. I did not notice because the tests downloads all dependencies. I'll try to fix it asap.

bjornharrtell added a commit that referenced this issue Mar 31, 2015
bjornharrtell added a commit that referenced this issue Mar 31, 2015
bjornharrtell added a commit that referenced this issue Mar 31, 2015
bjornharrtell added a commit that referenced this issue Mar 31, 2015
@bjornharrtell
Copy link
Owner

Think I finally got it fixed. Node version now uses source directly and npm install should handle all dependencies. Please reopen if issues remain.

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

7 participants