npm test给我ENOSPC错误,但与sudo一起使用
所以我只是在学习并遵循一个要求安装npm install --save-dev [email protected] [email protected]
的教程。
当我运行npm test
时,我得到以下输出:
(testdriven) linux@ubuntu:~/testdriven/testdriven-app/services/client$ npm install --save-dev [email protected] [email protected]
npm WARN [email protected] requires a peer of typescript@* but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/react-scripts/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
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"})
+ [email protected]
+ [email protected]
updated 2 packages and audited 36587 packages in 21.377s
found 0 vulnerabilities
(testdriven) linux@ubuntu:~/testdriven/testdriven-app/services/client$ npm test
> [email protected] 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.
阅读其他帖子,我了解到ENOSPC
是一个没有空格的错误。事实并非如此,我有70GB免费版。
是权限错误吗?我手动检查权限,但没有遇到任何问题。
任何想出这个问题的建议都会很棒。我现在可以继续学习本教程,但知道导致这个问题并修复它会很好。
谢谢!
回答如下:好。我找到了。
之前我没有看到完整错误的原因是我在VS Code中使用终端。当我从常规终端运行它时,我看到了解释它的完整错误以及解决方法。
"Visual Studio Code is unable to watch for file changes in this large workspace" (error ENOSPC)
https://code.visualstudio/docs/setup/linux#_visual-studio-code-is-unable-to-watch-for-file-changes-in-this-large-workspace-error-enospc