【问题标题】:YARN START gives no space left on device errorYARN START 在设备错误上没有剩余空间
【发布时间】:2019-02-20 02:59:43
【问题描述】:

操作系统:UBUNTU 18.04

我创建了一个简单的create-react-app 项目,然后使用yarn start 启动了一个服务器。 30% 的时候它工作正常,但 70% 的时候我得到以下错误。

Starting the development server...

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

Error: ENOSPC: no space left on device, watch '/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/public'
    at FSWatcher.start (internal/fs/watchers.js:164:26)
    at Object.watch (fs.js:1232:11)
    at createFsWatchInstance (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:37:15)
    at setFsWatchListener (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    at FSWatcher.NodeFsHandler._watchWithNodeFs (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:232:14)
    at FSWatcher.NodeFsHandler._handleDir (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:414:19)
    at FSWatcher.<anonymous> (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:462:19)
    at FSWatcher.<anonymous> (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:467:16)
    at FSReqWrap.oncomplete (fs.js:155:5)
Emitted 'error' event at:
    at FSWatcher._handleError (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/index.js:260:10)
    at createFsWatchInstance (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:39:5)
    at setFsWatchListener (/media/prameshbajra/pramesh/Code/learning-react-redux/shopping-cart/node_modules/chokidar/lib/nodefs-handler.js:80:15)
    [... lines matching original stack trace ...]
    at FSReqWrap.oncomplete (fs.js:155:5)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

我不知道这个错误是如何出现的。我的笔记本电脑上几乎没有存储任何东西,大约 90% 的硬盘是免费的。工作目录有将近 200+ GB 的可用空间。我还尝试通过将整个项目复制到不同的位置(也不同的驱动器)来启动项目,但没有成功。另外,尝试了npm start,但也没有用。

【问题讨论】:

    标签: npm create-react-app yarnpkg chokidar


    【解决方案1】:

    尝试删除你的 node_modules 文件夹,然后使用 NPM 安装 ('npm i') 并运行 ('npm run start'),而不是 Yarn。 我收到了同样的错误,阻止我使用 Yarn 运行我的 Node 项目。我尝试了 Node v10.10.0 和 v8.12.0。 删除我的 node_modules 文件夹并使用 Yarn 重新安装没有帮助。

    【讨论】:

    • Try removing your node_modules folder, then using NPM to install ('npm i') and run ('npm run start'), instead of Yarn - 这可能是修复,但我现在无法复制它。我切换到 Windows :P
    • rm -rf node_modules && rm yarn.lock && yarn && yarn start
    【解决方案2】:

    您需要检查您的 Node.js 版本。

    作为documentationYou’ll need to have Node &gt;= 6 on your local development machine

    【讨论】:

    • 不,不是这样。我的节点版本是v10.10.0,npm 版本是6.4.1
    • 试试版本v8.12.0,如果你有同样的结果告诉我。
    • 降级到较低版本也没有帮助。 :(
    【解决方案3】:

    我遇到了类似的问题。通过增加 inotify 手表的数量来解决它。在这里使用帮助: https://github.com/parcel-bundler/parcel/issues/1427 https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

    通过使用: sudo sysctl fs.inotify.max_user_watches=999999999 并坚持使用:

    echo fs.inotify.max_user_watches=999999999 | sudo tee -a /etc/sysctl.conf 
    sudo sysctl --system
    

    【讨论】:

    • 我的解决方案是切换操作系统,为此移至 Windows。您的解决方案(如果可行)非常明智:P。希望这对未来的读者有所帮助。
    猜你喜欢
    • 1970-01-01
    • 2015-08-16
    • 1970-01-01
    • 1970-01-01
    • 2017-05-06
    • 1970-01-01
    • 2018-06-29
    • 1970-01-01
    • 2021-06-16
    相关资源
    最近更新 更多