我在 win10 上使用 Docker Toolbox 运行 unbuntu:latest docker 容器。我使用 create-react-app npm 自动为我创建一个反应应用程序。当我运行“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 是一个检查文件是否更改的库 - 所以不确定这里到底发生了什么。我有点难过。任何帮助将不胜感激。