Skip to content

"npm test" fails with EPERM at fs.exists() on Windows #4290

@seaoak

Description

@seaoak

Check List

Please check followings before submitting a new issue.

  • I have already read Docs page & Troubleshooting page
  • I have already searched existing issues and they are not help to me
  • I examined error or warning messages and it's difficult to solve
  • Using the latest version of Hexo (run hexo version to check)
  • Node.js is higher than 8.6.0

Expected behavior

npm test command passes.

Actual behavior

npm test command fails with Error: EPERM: operation not permitted as follows:

SS20200503a hexo_npm_test_fail

This error is caused by calling fs.exists() for db.json.
The file db.json is removed (unlinked) immediately before.

How to reproduce?

$ git checkout master
$ npm test

Environment

OS: Windows 10 64bit (rev.1909)
Node.js: v12.16.2, v14.1.0, v10.20.1
AntiVirus: none (use "Windows Defender")

Source codes:

$ git log --oneline --decorate -1
2b63f9fc (HEAD -> master, upstream/master) perf(post): simplify codeblock escape (#4254)
$
$ (cd ../hexo-util && git log --oneline --decorate -1)
f5d510a (HEAD -> master, upstream/master, origin/master, origin/HEAD) Merge pull request #199 from curbengh/cache-class
$
$ (cd ../hexo-fs && git log --oneline --decorate -1) | cat
c0a4b6c (HEAD -> master, upstream/master, origin/master, origin/HEAD) ci(appveyor): stop updating npm (#68)
$

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions