尝试在Windows docker容器中运行时的fswatch错误

时间:2017-09-19 01:00:16

标签: node.js reactjs docker npm fswatch

我在win10上使用Docker Toolbox运行unbuntu:最新的docker容器。 我使用create-react-app npm为我自动创建一个react应用程序。 当我运行“npm start”时,我收到以下错误。

events.js:182
      throw er; // Unhandled 'error' event
      ^

Error: watch /frontend/public EMFILE
    at _errnoException (util.js:1026:11)
    at FSWatcher.start (fs.js:1383:19)
    at Object.fs.watch (fs.js:1409:11)
    at createFsWatchInstance (/frontend/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/frontend/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/frontend/node_modules/chokidar/lib/nodefs-handler.js:228:14)
    at FSWatcher.NodeFsHandler._handleDir (/frontend/node_modules/chokidar/lib/nodefs-handler.js:407:19)
    at FSWatcher.<anonymous> (/frontend/node_modules/chokidar/lib/nodefs-handler.js:455:19)
    at FSWatcher.<anonymous> (/frontend/node_modules/chokidar/lib/nodefs-handler.js:460:16)
    at FSReqWrap.oncomplete (fs.js:154:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! frontend@0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the frontend@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-09-19T00_53_33_776Z-debug.log

非常简单的东西 - 这是我的dockerFile

FROM ubuntu:latest

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update
RUN apt-get install -y apt-utils
RUN apt-get install -y curl
#RUN curl -sL https://deb.nodesource.com/setup_6.x | bash -
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
RUN apt-get install -y nodejs

# install editor
RUN apt-get install -y vim

# install tools and create frontend
RUN npm install -g create-react-app
RUN create-react-app frontend

# configure proxy (let's frontend talk to backend)
RUN sed '$i,\n"proxy": "http://localhost:3001"' frontend/package.json >> frontend/package.json.new
RUN cp frontend/package.json.new frontend/package.json

WORKDIR /frontend

# run the frontend
CMD npm start

我可以在我的mac上构建相同的dockerfile,它工作正常。 FSWatch是一个检查文件是否发生变化的库 - 所以不确定这里到底发生了什么。我有点难过。 任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:0)

Docker Toolbox不支持文件系统事件通知。 (由Docker dev Mano Marks确认)。 需要使用&#34; Docker for Windows&#34;它的工作原理。

猜猜MSFT正在贬低我。