npm test给我ENOSPC错误,但可以和sudo一起使用

时间:2019-02-15 19:42:44

标签: node.js reactjs npm

所以我只是在学习,并且正在学习要求安装android { defaultConfig { javaCompileOptions { annotationProcessorOptions { arguments = ["resourcePackageName": android.defaultConfig.applicationId] } } } } 的教程。

运行npm install --save-dev enzyme@3.8.0 enzyme-adapter-react-16@1.7.1时,得到以下输出:

npm test

但是,当我以(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. 运行它时,我得到了预期的结果。

sudo npm test

在阅读其他文章时,我了解到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. 是无空格错误。情况并非如此,我有70GB可用空间。

这是权限错误吗?我手动检查了权限,没有遇到任何问题。

任何解决此问题的建议都是很好的。我现在可以继续学习本教程,但是很高兴知道是什么原因造成的并进行修复。

谢谢!

1 个答案:

答案 0 :(得分:0)

好。我找到了。

之所以以前没有看到完整的错误,是因为我在VS Code中使用了终端。当我从常规终端上运行它时,我看到了完整的错误,以及解决方法,这可以解释该错误。

"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