Unable to use gatsby develop on ubuntu
After cloning my new ubuntu machine (RIP apple) I've installed gatsby and run npm i which gave me a warning
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
When I then run gatsby develop I get this error
success source and transform nodes — 0.401 s
success building schema — 0.139 s
success createPages — 0.035 s
error UNHANDLED EXCEPTION
Error: watch /home/###/git/###/node_modules/gatsby/dist/internal-plugins/dev-404-page/raw_dev-404-page.js ENOSPC
- nodefs-handler.js:37 createFsWatchInstance
[var]/[chokidar]/lib/nodefs-handler.js:37:15
- nodefs-handler.js:80 setFsWatchListener
[var]/[chokidar]/lib/nodefs-handler.js:80:15
- nodefs-handler.js:232 FSWatcher.NodeFsHandler._watchWithNodeFs
[var]/[chokidar]/lib/nodefs-handler.js:232:14
- nodefs-handler.js:259 FSWatcher.NodeFsHandler._handleFile
[var]/[chokidar]/lib/nodefs-handler.js:259:21
- nodefs-handler.js:480 FSWatcher.<anonymous>
[var]/[chokidar]/lib/nodefs-handler.js:480:21
Should update when files change
It failed
(node:16780) Warning: a promise was rejected with a non-error: [object Null]
System:
OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
CPU: x64 Intel(R) Core(TM) i7-8086K CPU @ 4.00GHz
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 8.9.4 - ~/.nvm/versions/node/v8.9.4/bin/node
Yarn: 1.9.4 - /usr/bin/yarn
npm: 5.6.0 - ~/.nvm/versions/node/v8.9.4/bin/npm
Browsers:
Chrome: 69.0.3497.92
Firefox: 62.0
npmPackages:
gatsby: ^2.0.0-beta.99 => 2.0.0-beta.99
gatsby-image: ^1.0.55 => 1.0.55
gatsby-plugin-manifest: ^2.0.2-beta.5 => 2.0.2-beta.5
gatsby-plugin-react-helmet: ^3.0.0-beta.4 => 3.0.0-beta.4
gatsby-plugin-styled-components: ^3.0.0-beta.3 => 3.0.0-beta.3
gatsby-source-contentful: ^2.0.1 => 2.0.1
npmGlobalPackages:
gatsby-cli: 2.4.1
Could it be that you're running out of disk space? Because of ENOSPC in the error message. Also, unrelated, you should update gatsby-image to v2.
I doubt I'm out of space, it's a fresh install. Which got me to thinking it could be a permissions issue.
So I tried sudo gatsby develop which gave me a command not found error. Then I tried sudo npm run develop and that worked!
Hmm, you really shouldn't run gatsby as root. Could you provide the specific steps how you (i) installed gatsby-cli and (ii) set up your project?
And you could check if raising fs.inotify.max_user_watches helps, since the crash happens with createFsWatchInstance: sudo sysctl fs.inotify.max_user_watches=524288
@stefanprobst thanks, raising fs.inotify.max_user_watches seems to have fixed it! Now running as my own user fine. :ok_hand:
Great! Note that setting this on the commandline is only temporary. To persist:
sudo -i
echo "fs.inotify.max_user_watches = 524288" > /etc/sysctl.d/99-local.conf
Issue seems resolved, so I'll close it
Something similar just happened with me as well when i was running npm run develop.
I mean the log had Error: ENOSPC: no space left on device, watch '/home/ammar/Desktop/mun-website/src'
I just ran gatsby develop and it worked. :thinking: