簡體   English   中英

嘗試在Windows Docker容器中運行React時出現fswatch錯誤

[英]fswatch error when trying to run react in a windows docker container

我正在win10上使用Docker Toolbox運行unbuntu:latest 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是一個用於檢查文件是否更改的庫-因此不確定此處到底發生了什么。 我有點難過。 任何幫助將不勝感激。

Docker Toolbox不支持文件系統事件通知。 (由Docker開發人員Mano Marks確認)。 需要使用“ Docker for Windows”才能運行。

猜猜MSFT讓我少了些錢。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM