0

So I'm just learning and while following a tutorial which asks to install npm install --save-dev enzyme@3.8.0 enzyme-adapter-react-16@1.7.1.

When I run npm test, I get the following output:

(testdriven) linux@ubuntu:~/testdriven/testdriven-app/services/client$ npm install --save-dev enzyme@3.8.0 enzyme-adapter-react-16@1.7.1
npm WARN ts-pnp@1.0.0 requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules/react-scripts/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ enzyme@3.8.0
+ enzyme-adapter-react-16@1.7.1
updated 2 packages and audited 36587 packages in 21.377s
found 0 vulnerabilities

(testdriven) linux@ubuntu:~/testdriven/testdriven-app/services/client$ npm test

> client@0.1.0 test /home/linux/testdriven/testdriven-app/services/client
> react-scripts test

fs.js:1384
    throw error;
    ^

Error: watch /home/linux/testdriven/testdriven-app/services/client/node_modules/.cache ENOSPC
    at _errnoException (util.js:1022:11)
    at FSWatcher.start (fs.js:1382:19)
    at Object.fs.watch (fs.js:1408:11)
    at NodeWatcher.watchdir (/home/linux/testdriven/testdriven-app/services/client/node_modules/sane/src/node_watcher.js:175:20)
    at Walker.<anonymous> (/home/linux/testdriven/testdriven-app/services/client/node_modules/sane/src/common.js:116:12)
    at emitTwo (events.js:126:13)
    at Walker.emit (events.js:214:7)
    at /home/linux/testdriven/testdriven-app/services/client/node_modules/walker/lib/walker.js:69:16
    at go$readdir$cb (/home/linux/testdriven/testdriven-app/services/client/node_modules/graceful-fs/graceful-fs.js:162:14)
    at FSReqWrap.oncomplete (fs.js:135:15)
npm ERR! Test failed.  See above for more details.

Yet, when I run it as sudo npm test, I get the expected result.

No tests found related to files changed since last commit.
Press `a` to run all tests, or run Jest with `--watchAll`.

Watch Usage
 › Press a to run all tests.
 › Press f to run only failed tests.
 › Press p to filter by a filename regex pattern.
 › Press q to quit watch mode.
 › Press t to filter by a test name regex pattern.
 › Press Enter to trigger a test run.

Reading other posts, I learned that ENOSPC is a no space error. Which is not the case, I have 70GB free.

Is it a permission error? I manually checked the permissions and did not come across anything.

Any suggestion to figure this out would be great. I can continue with the tutorial for now but it would be nice to know what causes this and fix it.

Thanks!

Elfwig
  • 1
  • 1
  • Possible duplicate of [Node.js: what is ENOSPC error and how to solve?](https://stackoverflow.com/questions/22475849/node-js-what-is-enospc-error-and-how-to-solve) – ESV Apr 16 '19 at 22:24

2 Answers2

0

OK. I found it.

The reason why I did not see the complete error previously is that I was using terminal inside VS Code. When I ran it from a regular terminal I saw the complete error which this explains it, along with the workaround.

"Visual Studio Code is unable to watch for file changes in this large workspace" (error ENOSPC)

https://code.visualstudio.com/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc

Elfwig
  • 1
  • 1
0

[The fact that you are out of watches does not mean that its VSCode's fault.]

Let's fix it

  • Open a new terminal.

  • You can get your current inotify file watch limit by executing:

      $ cat /proc/sys/fs/inotify/max_user_watches
    
  • You can set a new limit temporary with:

      $ sudo sysctl fs.inotify.max_user_watches=524288
    
      $ sudo sysctl -p
    

    return:

      fs.inotify.max_user_watches = 524288
    
  • If you like to make your limit permanent, use:

      $ echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf
    
    
      $ sudo sysctl -p
    

source

foysalf652
  • 208
  • 1
  • 10