{"action":"created","issue":{"url":"https://api.github.com/repos/npm/npm/issues/17802","repository_url":"https://api.github.com/repos/npm/npm","labels_url":"https://api.github.com/repos/npm/npm/issues/17802/labels{/name}","comments_url":"https://api.github.com/repos/npm/npm/issues/17802/comments","events_url":"https://api.github.com/repos/npm/npm/issues/17802/events","html_url":"https://github.com/npm/npm/pull/17802","id":243223373,"number":17802,"title":"Fix: normalize windows-like slashes inside `npm rebuild` and magical cure for Meteor Up deployment with `bcrypt` etc.","user":{"login":"mrauhu","id":2821574,"avatar_url":"https://avatars1.githubusercontent.com/u/2821574?v=4","gravatar_id":"","url":"https://api.github.com/users/mrauhu","html_url":"https://github.com/mrauhu","followers_url":"https://api.github.com/users/mrauhu/followers","following_url":"https://api.github.com/users/mrauhu/following{/other_user}","gists_url":"https://api.github.com/users/mrauhu/gists{/gist_id}","starred_url":"https://api.github.com/users/mrauhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrauhu/subscriptions","organizations_url":"https://api.github.com/users/mrauhu/orgs","repos_url":"https://api.github.com/users/mrauhu/repos","events_url":"https://api.github.com/users/mrauhu/events{/privacy}","received_events_url":"https://api.github.com/users/mrauhu/received_events","type":"User","site_admin":false},"labels":[{"id":79362848,"url":"https://api.github.com/repos/npm/npm/labels/needs-tests","name":"needs-tests","color":"71A6A1","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-07-16T07:36:26Z","updated_at":"2017-08-11T22:24:34Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/npm/npm/pulls/17802","html_url":"https://github.com/npm/npm/pull/17802","diff_url":"https://github.com/npm/npm/pull/17802.diff","patch_url":"https://github.com/npm/npm/pull/17802.patch"},"body":"Hello.\r\n\r\nWhen you try to deploy a Meteor 1.4.2+ project from the Windows host to the Linux server\r\nusing the `mup deploy` or `meteor build --architecture os.linux.x86_64` and you having in the `packages.json` any native Node.js modules you get failed deployment.\r\n\r\n## :cocktail: Instant cure for Meteor Up deployment\r\n\r\nOpen `mup.js` and change value of field `docker.image` to [`mrauhu/meteord:base`](https://github.com/mrauhu/meteord), which uses patched scoped NPM: [@mrauhu/npm](https://github.com/mrauhu/npm)\r\n\r\n## Why NPM repository?\r\n\r\nBecause Meteor  using NPM on the host with `meteor build` and on the server with `npm-rebuild.js`.\r\n\r\n> Note:\r\n> Meteor 1.5 working with `npm@4`, and only future release 1.6 will be used `npm@5`.\r\n\r\n## How to reproduce\r\n\r\n### Prerequisites\r\n\r\n1. Machine with Windows >= 7.\r\n2. 64-bit Debian/Ubuntu GNU/Linux server with remote access via SSH.\r\n3. Installed [Meteor](https://github.com/meteor/meteor) with version >= 1.4.2, because of this commit https://github.com/meteor/meteor/commit/4618b3d8de240db33bb48c1f42eaabd47535183b, grab it here:\r\nhttps://www.meteor.com/install\r\n4. [Meteor Up](https://github.com/zodern/meteor-up)\r\n`npm install -g mup`\r\n\r\n\r\n### Steps\r\n\r\n1. Create Meteor application\r\n\r\n```\r\nmeteor create --bare test-app\r\ncd test-app\r\n```\r\n2. Add `bcrypt` node package\r\n\r\n```\r\nmeteor npm install --save bcrypt\r\n```\r\n\r\n3. Init Meteor Up.\r\n\r\n```\r\nmkdir private\r\ncd private\r\nmup.cmd init\r\n```\r\n\r\n4. Edit config file `mup.js`.\r\n\r\n5. Setup server and deploy\r\n```\r\nmup.cmd setup\r\nmup.cmd deploy --verbose && mup.cmd logs -f\r\n```\r\n\r\n6. You get error\r\n\r\n<details>\r\n  <summary><code>ERR! path /bundle/bundle/programs/server/npm/node_modules/meteor/npm-container/node_modules/sshpk/bin\\sshpk-conv</code></summary>\r\n<pre>\r\n[xx.xx.xx.xx]> meteor-dev-bundle@0.0.0 install /bundle/bundle/programs/server\r\n[xx.xx.xx.xx]> node npm-rebuild.js\r\n[xx.xx.xx.xx]npm ERR! Linux 4.4.0-78-generic\r\n[xx.xx.xx.xx]npm ERR! argv \"/opt/nodejs/bin/node\" \"/opt/nodejs/bin/npm\" \"rebuild\" \"--update-binary\"\r\n[xx.xx.xx.xx]npm ERR! node v4.8.0\r\n[xx.xx.xx.xx]npm ERR! npm v3.10.10\r\n[xx.xx.xx.xx]npm ERR! path /bundle/bundle/programs/server/npm/node_modules/meteor/npm-container/node_modules/sshpk/bin\\sshpk-conv\r\n[xx.xx.xx.xx]npm ERR! code ENOENT\r\n[xx.xx.xx.xx]npm ERR! errno -2\r\n[xx.xx.xx.xx]npm ERR! syscall chmod\r\n[xx.xx.xx.xx]npm ERR! enoent ENOENT: no such file or directory, chmod '/bundle/bundle/programs/server/npm/node_modules/meteor/npm-container/node_modules/sshpk/bin\\sshpk-conv'\r\n[xx.xx.xx.xx]npm ERR! enoent ENOENT: no such file or directory, chmod '/bundle/bundle/programs/server/npm/node_modules/meteor/npm-container/node_modules/sshpk/bin\\sshpk-conv'\r\n[xx.xx.xx.xx]npm ERR! enoent This is most likely not a problem with npm itself\r\n</pre>\r\n</details>\r\n\r\nBecause NPM try to rebuild packages on Linux and it failed use windows-like executable path in the `node-sshpk` dependency of `bcrypt`.\r\n\r\n### Linked issues\r\n\r\n* Tarball created in Windows using \"meteor build\" fails to deploy to hosting environment\r\nhttps://github.com/meteor/meteor/issues/7401\r\n* Bcrypt issue \r\nhttps://github.com/abernix/meteord/issues/8\r\n* Deployment fails with exit error 254 !!!!\r\nhttps://github.com/zodern/meteor-up/issues/642\r\n* Bcrypt\r\nhttps://github.com/zodern/meteor-up/issues/267\r\n* Working with Meteor 1.4? \r\nfix https://github.com/zodern/meteor-up/issues/172\r\n"},"comment":{"url":"https://api.github.com/repos/npm/npm/issues/comments/321932030","html_url":"https://github.com/npm/npm/pull/17802#issuecomment-321932030","issue_url":"https://api.github.com/repos/npm/npm/issues/17802","id":321932030,"user":{"login":"mrauhu","id":2821574,"avatar_url":"https://avatars1.githubusercontent.com/u/2821574?v=4","gravatar_id":"","url":"https://api.github.com/users/mrauhu","html_url":"https://github.com/mrauhu","followers_url":"https://api.github.com/users/mrauhu/followers","following_url":"https://api.github.com/users/mrauhu/following{/other_user}","gists_url":"https://api.github.com/users/mrauhu/gists{/gist_id}","starred_url":"https://api.github.com/users/mrauhu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mrauhu/subscriptions","organizations_url":"https://api.github.com/users/mrauhu/orgs","repos_url":"https://api.github.com/users/mrauhu/repos","events_url":"https://api.github.com/users/mrauhu/events{/privacy}","received_events_url":"https://api.github.com/users/mrauhu/received_events","type":"User","site_admin":false},"created_at":"2017-08-11T22:24:34Z","updated_at":"2017-08-11T22:24:34Z","body":"> Is there an issue over with the meteor folks for them to patch this?\r\n\r\nMeteor folks just use NPM in two cases:\r\n\r\n* `npm install <name> --save`\r\nfor using Node modules in project\r\n* `npm rebuild --update-binary`\r\nfor running Meteor project on server\r\n\r\n## Failed deployment chain of events\r\n\r\n### Windows machine\r\n\r\n* `npm install bcrypt --save` creates:\r\n  * `node_modules/bcrypt`\r\n  * `node_modules/sshpk` with `package.json` bin section:\r\n  ```\r\n  \"bin\": {\r\n    \"sshpk-conv\": \"bin\\\\sshpk-conv\",\r\n    \"sshpk-sign\": \"bin\\\\sshpk-sign\",\r\n    \"sshpk-verify\": \"bin\\\\sshpk-verify\"\r\n  },  ```\r\n* `mup deploy` first part run:\r\n  * `meteor build` which create `bundle.tar.gz`\r\n\r\n### Linux machine\r\n\r\n* `mup deploy` second part:\r\n  * upload `bundle.tar.gz` on server\r\n  * run Docker image with Node.js and NPM, which run `node main.js`\r\n* `node main.js` required `npm-rebuild.js` that's basically wrapper for:\r\n  * `npm rebuild ----update-binary`\r\n* `npm rebuild` failed because it is use Node.js `path.resolve` for path:\r\n```\r\n# Original string concatenation\r\n/bundle/bundle/programs/server/npm/node_modules/meteor/npm-container/node_modules/sshpk/bin\\\\sshpk-conv\r\n# After converting by OS\r\n/bundle/bundle/programs/server/npm/node_modules/meteor/npm-container/node_modules/sshpk/bin\\sshpk-conv\r\n# System cannot find this path\r\n```\r\n\r\nNor `\\\\`, nor `\\` is correct directory separators for POSIX.\r\nOnly correct directory separator is `/`.\r\n\r\n## Solution\r\n\r\nMy solution is path the `npm rebuild` function for auto convert `\\\\` to `/`.\r\nIt is cross-platform, because for Windows correct directory separators is:\r\n\r\n* `\\\\`\r\n* `/`\r\n"}}
{"actor":{"display_login":"mrauhu"}}