{"action":"created","issue":{"url":"https://api.github.com/repos/nodejs/node/issues/8897","repository_url":"https://api.github.com/repos/nodejs/node","labels_url":"https://api.github.com/repos/nodejs/node/issues/8897/labels{/name}","comments_url":"https://api.github.com/repos/nodejs/node/issues/8897/comments","events_url":"https://api.github.com/repos/nodejs/node/issues/8897/events","html_url":"https://github.com/nodejs/node/issues/8897","id":180511453,"number":8897,"title":"Windows Container: npm can't be used in docker volume directory","user":{"login":"StefanScherer","id":207759,"avatar_url":"https://avatars.githubusercontent.com/u/207759?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanScherer","html_url":"https://github.com/StefanScherer","followers_url":"https://api.github.com/users/StefanScherer/followers","following_url":"https://api.github.com/users/StefanScherer/following{/other_user}","gists_url":"https://api.github.com/users/StefanScherer/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanScherer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanScherer/subscriptions","organizations_url":"https://api.github.com/users/StefanScherer/orgs","repos_url":"https://api.github.com/users/StefanScherer/repos","events_url":"https://api.github.com/users/StefanScherer/events{/privacy}","received_events_url":"https://api.github.com/users/StefanScherer/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nodejs/node/labels/question","name":"question","color":"cc317c"},{"url":"https://api.github.com/repos/nodejs/node/labels/windows","name":"windows","color":"9944dd"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-02T13:06:45Z","updated_at":"2016-10-16T13:16:12Z","closed_at":null,"body":"* **Version**: 6.7.0\r\n* **Platform**: Running a NanoServer Docker container inside Windows 10 1607\r\n* **Subsystem**: fs\r\n\r\nI tried to follow Docker's blog post [Live Debugging with Docker](https://blog.docker.com/2016/07/live-debugging-docker/) (code sample is there), but with Windows 10 1607 and Docker installed as described in [MSDN](https://msdn.microsoft.com/en-us/virtualization/windowscontainers/quick_start/quick_start_windows_10).\r\n\r\nRunning a Windows Docker container with the Node.js code mapped from the Windows 10 machine to the container as a volume shows problems with `npm` or `nodemon`.\r\n\r\nExample to run a Docker container with the example code mapped from `C:\\node-example` on the host to `c:\\code` inside the Windows container:\r\n\r\n```\r\nC:\\node-example> docker run -it -v c:\\node-example:c:\\code stefanscherer/node-windows:6.7.0-nano cmd\r\n```\r\n\r\nNow inside the Windows container:\r\n\r\n```\r\nC:\\>cd code\r\n\r\nC:\\code>dir\r\n Volume in drive C has no label.\r\n Volume Serial Number is 469C-A136\r\n\r\n Directory of C:\\code\r\n\r\n10/02/2016  05:36 AM    <DIR>          .\r\n10/02/2016  05:36 AM    <DIR>          ..\r\n10/02/2016  05:05 AM               849 app.js\r\n10/02/2016  05:20 AM               228 docker-compose.yml\r\n10/02/2016  05:07 AM               242 Dockerfile\r\n10/02/2016  05:05 AM               501 index.html\r\n10/02/2016  05:36 AM    <DIR>          node_modules\r\n10/02/2016  05:05 AM               130 package.json\r\n               5 File(s)          1,950 bytes\r\n               3 Dir(s)  43,752,046,592 bytes free\r\n\r\nC:\\code>dir \\\r\n Volume in drive C has no label.\r\n Volume Serial Number is 469C-A136\r\n\r\n Directory of C:\\\r\n\r\n10/02/2016  05:36 AM    <SYMLINKD>     code [\\\\?\\ContainerMappedDirectories\\DFFDD9DD-2DFA-4981-9265-3BEE2B21AC39]\r\n09/22/2016  02:24 AM               664 License.txt\r\n09/28/2016  11:02 PM    <DIR>          nodejs\r\n07/16/2016  05:20 AM    <DIR>          Program Files\r\n07/16/2016  05:09 AM    <DIR>          Program Files (x86)\r\n09/22/2016  02:30 AM    <DIR>          Users\r\n09/28/2016  11:02 PM    <DIR>          Windows\r\n               1 File(s)            664 bytes\r\n               6 Dir(s)  21,209,907,200 bytes free\r\n```\r\n\r\nAs you can see the volume `C:\\code` inside the docker container is symlinked to `\\\\?\\ContainerMappedDirectories\\DFFDD9DD-2DFA-4981-9265-3BEE2B21AC39`, but `npm` as well as `nodemon` tries to access `C:\\ContainerMappedDirectories` instead. See the current output of both tools below:\r\n\r\n## npm install inside Windows container\r\n\r\n```\r\nC:\\code>npm install\r\nnpm info it worked if it ends with ok\r\nnpm info using npm@3.10.3\r\nnpm info using node@v6.7.0\r\nnpm info ok\r\nnpm info it worked if it ends with ok\r\nnpm info using npm@3.10.3\r\nnpm info using node@v6.7.0\r\nnpm ERR! Windows_NT 10.0.14393\r\nnpm ERR! argv \"C:\\\\nodejs\\\\node.exe\" \"C:\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js\" \"install\"\r\nnpm ERR! node v6.7.0\r\nnpm ERR! npm  v3.10.3\r\nnpm ERR! path C:\\ContainerMappedDirectories\r\nnpm ERR! code ENOENT\r\nnpm ERR! errno -4058\r\nnpm ERR! syscall lstat\r\n\r\nnpm ERR! enoent ENOENT: no such file or directory, lstat 'C:\\ContainerMappedDirectories'\r\nnpm ERR! enoent ENOENT: no such file or directory, lstat 'C:\\ContainerMappedDirectories'\r\nnpm ERR! enoent This is most likely not a problem with npm itself\r\nnpm ERR! enoent and is related to npm not being able to find a file.\r\nnpm ERR! enoent\r\n\r\nnpm ERR! Please include the following file with any support request:\r\nnpm ERR!     C:\\code\\npm-debug.log\r\n\r\nC:\\code>type npm-debug.log\r\n0 info it worked if it ends with ok\r\n1 verbose cli [ 'C:\\\\nodejs\\\\node.exe',\r\n1 verbose cli   'C:\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js',\r\n1 verbose cli   'install' ]\r\n2 info using npm@3.10.3\r\n3 info using node@v6.7.0\r\n4 silly loadCurrentTree Starting\r\n5 silly install loadCurrentTree\r\n6 silly install readLocalPackageData\r\n7 silly rollbackFailedOptional Starting\r\n8 silly rollbackFailedOptional Finishing\r\n9 silly runTopLevelLifecycles Starting\r\n10 silly runTopLevelLifecycles Finishing\r\n11 silly install printInstalled\r\n12 verbose stack Error: ENOENT: no such file or directory, lstat 'C:\\ContainerMappedDirectories'\r\n12 verbose stack     at Error (native)\r\n13 verbose cwd C:\\code\r\n14 error Windows_NT 10.0.14393\r\n15 error argv \"C:\\\\nodejs\\\\node.exe\" \"C:\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js\" \"install\"\r\n16 error node v6.7.0\r\n17 error npm  v3.10.3\r\n18 error path C:\\ContainerMappedDirectories\r\n19 error code ENOENT\r\n20 error errno -4058\r\n21 error syscall lstat\r\n22 error enoent ENOENT: no such file or directory, lstat 'C:\\ContainerMappedDirectories'\r\n23 error enoent ENOENT: no such file or directory, lstat 'C:\\ContainerMappedDirectories'\r\n23 error enoent This is most likely not a problem with npm itself\r\n23 error enoent and is related to npm not being able to find a file.\r\n24 verbose exit [ -4058, true ]\r\n```\r\n\r\n## nodemon inside Windows container\r\n\r\n```\r\nC:\\code>npm install -g nodemon\r\nC:\\code>nodemon --debug=5858 app.js\r\n[nodemon] 1.10.2\r\n[nodemon] to restart at any time, enter `rs`\r\n[nodemon] watching: *.*\r\n[nodemon] starting `node --debug=5858 app.js`\r\nDebugger listening on [::]:5858\r\nfs.js:982\r\n  return binding.lstat(pathModule._makeLong(path));\r\n                 ^\r\n\r\nError: ENOENT: no such file or directory, lstat 'C:\\ContainerMappedDirectories'\r\n    at Error (native)\r\n    at Object.fs.lstatSync (fs.js:982:18)\r\n    at Object.realpathSync (fs.js:1647:19)\r\n    at Function.Module._findPath (module.js:167:25)\r\n    at Function.Module._resolveFilename (module.js:453:25)\r\n    at Function.Module._load (module.js:403:25)\r\n    at Module.runMain (module.js:590:10)\r\n    at run (bootstrap_node.js:394:7)\r\n    at startup (bootstrap_node.js:149:9)\r\n    at bootstrap_node.js:509:3\r\n[nodemon] app crashed - waiting for file changes before starting...\r\n```\r\n\r\n## Workaround\r\nI found a workaround: Use `C:\\ContainerMappedDirectories` as the volume mount point inside the container :-) Then at least `nodemon` works in the volume mount point.\r\n\r\n```\r\nC:\\containermappeddirectories>nodemon --debug=5858 app.js\r\n[nodemon] 1.10.2\r\n[nodemon] to restart at any time, enter `rs`\r\n[nodemon] watching: *.*\r\n[nodemon] starting `node --debug=5858 app.js`\r\nDebugger listening on [::]:5858\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/nodejs/node/issues/comments/254046252","html_url":"https://github.com/nodejs/node/issues/8897#issuecomment-254046252","issue_url":"https://api.github.com/repos/nodejs/node/issues/8897","id":254046252,"user":{"login":"StefanScherer","id":207759,"avatar_url":"https://avatars.githubusercontent.com/u/207759?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanScherer","html_url":"https://github.com/StefanScherer","followers_url":"https://api.github.com/users/StefanScherer/followers","following_url":"https://api.github.com/users/StefanScherer/following{/other_user}","gists_url":"https://api.github.com/users/StefanScherer/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanScherer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanScherer/subscriptions","organizations_url":"https://api.github.com/users/StefanScherer/orgs","repos_url":"https://api.github.com/users/StefanScherer/repos","events_url":"https://api.github.com/users/StefanScherer/events{/privacy}","received_events_url":"https://api.github.com/users/StefanScherer/received_events","type":"User","site_admin":false},"created_at":"2016-10-16T13:16:12Z","updated_at":"2016-10-16T13:16:12Z","body":"Just to clarify, if someone else tries this and wants a temporary solution. This only occurs with Node.js 6.x and works fine with Node.js 4.6.0\r\n\r\n```\r\ndocker run -it --rm --name my-app -v \"${pwd}:C:\\App\" -w \"C:\\App\" -p 3000:3000 -p 9000:9000 stefanscherer/node-windows:4.6.0 powershell\r\n```\r\n"}}
{"actor":{"display_login":"StefanScherer"}}