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

Build fails when using ember-cli-ramdisk #16

Open
IanVS opened this issue Jan 26, 2015 · 9 comments
Open

Build fails when using ember-cli-ramdisk #16

IanVS opened this issue Jan 26, 2015 · 9 comments

Comments

@IanVS
Copy link

IanVS commented Jan 26, 2015

I created an issue at ember-cli-ramdisk [https://github.com/FutureProofRetail/ember-cli-ramdisk/issues/8], but thought you might like to know about this as well. When using that addon, I am unable to import modules. For example if I try to import moment from 'npm:moment'; I get the error:

Error: Cannot find module 'moment' from '/mnt/EmberCliRamdisk/borrowers/core_object-input_staging-HpoS1dc8.tmp'
    at /mnt/sdb1/code/websites/borrowers/node_modules/ember-browserify/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:50:17
    at process (/mnt/sdb1/code/websites/borrowers/node_modules/ember-browserify/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:119:43)
    at /mnt/sdb1/code/websites/borrowers/node_modules/ember-browserify/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:128:21
    at load (/mnt/sdb1/code/websites/borrowers/node_modules/ember-browserify/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:60:43)
    at /mnt/sdb1/code/websites/borrowers/node_modules/ember-browserify/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:66:22
    at /mnt/sdb1/code/websites/borrowers/node_modules/ember-browserify/node_modules/browserify/node_modules/browser-resolve/node_modules/resolve/lib/async.js:21:47
    at Object.oncomplete (fs.js:108:15)

I have no idea what the actual problem is, which is why I brought it up in both repos.

@ef4
Copy link
Owner

ef4 commented Jan 27, 2015

Browserify is picky about where your tmp folder lives relative to your node_modules folder. If you can mount the actual ramdisk at your-app/tmp instead of just symlinking it, that would probably solve this. Alternatively, you could try symlinking your node_modules folder into the real ramdisk location, so that code being built there can find it via normal node rules.

@IanVS
Copy link
Author

IanVS commented Jan 28, 2015

@ef4, moving node_modules to /mnt/EmberCliRamdisk//node_modules/ and symlinking back to my project folder seems to be working . . . as long as I don't reboot. :-o

I think I'll just move my Ember project folders to my HDD and avoid the hassle. Thanks for explaining the cause.

@stefanpenner
Copy link
Collaborator

@ef4 we have plans to move the tmp folder outside of the project. We will likely need to fixup how ember-browserify works for that. Can we inform browserify of the correct node_modules root/package.json to review?

@ef4
Copy link
Owner

ef4 commented Feb 1, 2015

As far as I know it's not easy. browserify is trying hard to maintain normal node semantics. node is really picky about only using the node_modules hierarchy.

So I think the right thing to make sure that the project's node_modules is available within the build tree that gets passed to browserify. A symlink should suffice.

@stefanpenner
Copy link
Collaborator

@ef4 if symlink works, then fantastic. But does leave our windows friends in a bad spot.

I wonder if we can bend substacks arm

@IanVS
Copy link
Author

IanVS commented Feb 1, 2015

It worked for me with symlinking node_modules. How would this work for multiple projects if tmp and node_modules both live outside the project folder? I like that ember-cli is self contained as it is now.

@stefanpenner
Copy link
Collaborator

node_modules will remain in the project, tmp will not. It is a hazard for editors and other tools watching `tmp/*

@stefanpenner
Copy link
Collaborator

stefanpenner commented Apr 27, 2016

@ef4 this will also break with broccoli v1, one thing we could do is make a custom browserify-tmp dir in the project root, thoughts?

@stefanpenner
Copy link
Collaborator

This will actually need to be revisited, when broccoli 1.0 happens and tmp moves to system tmp. The solution is to symlink (and junction for our windows friends) in node_modules to the basedir of browserify.

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