vagrant-spk
vagrant-spk copied to clipboard
Failure running Meteor app with externalify dependency
Trying to add React as per these instructions:
http://react-in-meteor.readthedocs.org/en/latest/client-npm/
Unfortunately, configuration that works well in other projects fails with anything running in Sandstorm:
=> Errors while initializing project:
Loading package [email protected] |
While building package npm-container:
error: couldn't install npm packages from npm-shrinkwrap: Command failed: npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm ERR! Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js'
npm ERR! { [Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path:
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js'
}
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command "/home/vagrant/.meteor/packages/meteor-tool/.1.1.9.16b7wh0++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node"
"/home/vagrant/.meteor/packages/meteor-tool/.1.1.9.16b7wh0++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm" "install"
npm ERR! cwd /opt/app/packages/npm-container/.npm/package-new-1y1etu2
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! path
/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js'
npm ERR! Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js'
npm ERR! { [Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path:
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js'
}
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command "/home/vagrant/.meteor/packages/meteor-tool/.1.1.9.16b7wh0++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node"
"/home/vagrant/.meteor/packages/meteor-tool/.1.1.9.16b7wh0++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm" "install"
npm ERR! cwd /opt/app/packages/npm-container/.npm/package-new-1y1etu2
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! path
/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /opt/app/packages/npm-container/.npm/package-new-1y1etu2/npm-debug.log
npm ERR! not ok code 0
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data
npm ERR! Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js'
npm ERR! { [Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path:
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js'
}
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command "/home/vagrant/.meteor/packages/meteor-tool/.1.1.9.16b7wh0++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node"
"/home/vagrant/.meteor/packages/meteor-tool/.1.1.9.16b7wh0++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm" "install"
npm ERR! cwd /opt/app/packages/npm-container/.npm/package-new-1y1etu2
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! path
/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/source-map/test/source-map/test-source-map-generator.js'
npm ERR! Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js'
npm ERR! { [Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js']
npm ERR! errno: 50,
npm ERR! code: 'EPERM',
npm ERR! path:
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js'
}
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.16.0-4-amd64
npm ERR! command "/home/vagrant/.meteor/packages/meteor-tool/.1.1.9.16b7wh0++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/node"
"/home/vagrant/.meteor/packages/meteor-tool/.1.1.9.16b7wh0++os.linux.x86_64+web.browser+web.cordova/mt-os.linux.x86_64/dev_bundle/bin/npm" "install"
npm ERR! cwd /opt/app/packages/npm-container/.npm/package-new-1y1etu2
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! path
/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js
npm ERR! code EPERM
npm ERR! errno 50
npm ERR! stack Error: EPERM, open
'/opt/app/packages/npm-container/.npm/package-new-1y1etu2/node_modules/externalify/node_modules/replace-require-functions/node_modules/detective/node_modules/escodegen/node_modules/optionator/node_modules/fast-levenshtein/levenshtein.js'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /opt/app/packages/npm-container/.npm/package-new-1y1etu2/npm-debug.log
npm ERR! not ok code 0
Loading package [email protected] |
Connection to 127.0.0.1 closed.
Calling 'vagrant' 'ssh' '-c' '/opt/app/.sandstorm/build.sh && cd /opt/app/.sandstorm && spk dev --pkg-def=/opt/app/.sandstorm/sandstorm-pkgdef.capnp:pkgdef' in /cygdrive/c/users/nolan/Projects/Sandstorm/.sandstorm
Traceback (most recent call last):
File "/cygdrive/c/users/nolan/appdata/local/bin/vagrant-spk", line 406, in <module>
main()
File "/cygdrive/c/users/nolan/appdata/local/bin/vagrant-spk", line 403, in main
operation(args)
File "/cygdrive/c/users/nolan/appdata/local/bin/vagrant-spk", line 310, in dev
"spk dev --pkg-def=/opt/app/.sandstorm/sandstorm-pkgdef.capnp:pkgdef"
File "/cygdrive/c/users/nolan/appdata/local/bin/vagrant-spk", line 189, in call_vagrant_command
return subprocess.check_call(command, cwd=sandstorm_dir)
File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['vagrant', 'ssh', '-c', '/opt/app/.sandstorm/build.sh && cd /opt/app/.sandstorm && spk dev --pkg-def=/opt/app/.sandstorm/sandstorm-pkgdef.capnp:pkgdef']' returned non-zero exit status 1
Here is a test repository that exhibits the behavior for me:
https://github.com/ndarilek/sandstorm-meteor-spk-externalify-issue.
Maybe externalify isn't the cause, but it looks related.
Thanks.
Interesting! I just tried to build that app and I got
$ vagrant-spk setupvm meteor
...
$ vagrant-spk up
...
$ vagrant-spk init
...
$ vagrant-spk dev
Calling 'vagrant' 'ssh' '-c' '/opt/app/.sandstorm/build.sh && cd /opt/app/.sandstorm && spk dev --pkg-def=/opt/app/.sandstorm/sandstorm-pkgdef.capnp:pkgdef' in /Users/dwrensha/Desktop/sandstorm-meteor-spk-externalify-issue/.sandstorm
npm-container: updating npm dependencies -- externalify, react-bootstrap...
Bower: { [Error: Package bootstrap not found] stack: [Getter] }
Bower: { [Error: git is not installed or not in the PATH] stack: [Getter] }
Bower: { [Error: git is not installed or not in the PATH] stack: [Getter] }
Bower: { [Error: git is not installed or not in the PATH] stack: [Getter] }
Errors prevented bundling:
While building the application:
<runJavaScript-27>:261:55: Cannot read property 'name' of undefined (compiling bower.json)
at getDependencies (<runJavaScript-27>:261:55)
at <runJavaScript-27>:272:5
at Function._.each._.forEach (<runJavaScript-11>:155:22)
at getDependencies (<runJavaScript-27>:271:5)
at bowerHandler (<runJavaScript-27>:128:29)
at Package (<runJavaScript-27>:314:10)
But then I tried running meteor outside of vagrant-spk, and the app booted fine. Then I tried vagrant-spk dev again and it worked!
Thanks, switched to the official Meteor Bootstrap package and that error should be fixed.
I'm using vagrant-spk from master, wonder if that might be the issue?
FWIW, I observe that the paths that were failing were fairly long (227 characters past your source directory's root). If your source folder's absolute path is more than 33 characters long, you might have been hitting the 260-character path limit on Windows (VirtualBox shared folders don't use the \\?\ prefix when specifying paths to the platform, which would allow paths up to ~32768 UCS-2 characters) which I think would trigger EPERM as seen by the guest. This is one of the weaknesses of the npm ecosystem and its approach to dependency management.
I could believe that switching Bootstrap packages also changed the dependencies, and the official dependencies might have been less-nested, making things neater on Windows.
https://github.com/mitchellh/vagrant/pull/5495 and https://github.com/mitchellh/vagrant/issues/5933 are both fascinating for the Vagrant perspective on this.
Huh, yeah, that's a possibility. Not sure why it would work fine under Windows but would fail in vagrant-spk. I blame gremlins.
But this revives a thought I've had for a while now. Perhaps some level of vagrant-spk, probably above the stack level, could copy the host directory into a Vagrant-managed path (I.e. /home/vagrant/app) before doing whatever it needs? Then it won't hit any Windows path length limits because it's happening entirely within ext4. I thought this may already have been happening, in which case I'm not sure why path lengths would be an issue at all.
Does my app package on sane OSs? Unfortunately I can't spin up a non-Vagrant VM to test.
Perhaps on Windows we should use the 'rsync' shared folder mode, which creates a worse experience in the common case but a better experience in the worst case.
That could work too, though do any of the vagrant-spk dev use cases
support live editing of code? I don't think I'm hitting a
Windows-specific limit regarding the mere existence of my code (I.e. I
don't think any of the code path limits are 200+ characters in length)
so it wouldn't be too much to copy/rsync the shared folder into a
staging area everywhere prior to building the spk.
I've only worked with Meteor, so perhaps PHP/Python do allow for live code edits. In that case, perhaps the rsync shared folder under Windows would be the best approach.
The PHP stack definitely supports live-reload. The Python stack can, depending on how you've configured your Python application. The static backend will serve updates to files live. So that's basically "everything except Meteor".
That said, we do capture the stack in use as .sandstorm/stack, so we could theoretically provide different behavior for Meteor on Windows.
Ah, so using rsync under Windows everywhere is probably the best solution then. Ugly, but then again so is Windows. :)
Sadly, we do typically need two-way sync for other stacks: /opt/app/.sandstorm needs to be writable by the app, so that sandstorm-files.list will sync out to the host, as well as to support getting a file on the host out of vagrant-spk pack. Since most stacks don't provide a hermetic bundle, but instead have to trace actual files accessed, and can easily miss e.g. JS used on only one page or other things like that, it's important that sandstorm-files.list not vanish into the guest's storage.