问题
My code is : http://pastebin.com/rCy4wSUK
As soon as this function is called by router it prints "done copying contents of clean base into temp" and then error which is here: http://pastebin.com/UxEu4PaS
So at least it is not giving an error in copying but what is causing it to throw this error.
回答1:
Sounds like the fs.extra module has not installed completely and is missing a dependency. Your code runs fine for me with a fresh npm install fs.extra q
Remove your node_modules
folder and re-run npm install
(if your dependencies are listed in package.json
) or npm install fs.extra q
(if they are not).
回答2:
I've seen this issue on case-insensitive filesystems in projects that require different versions of walk that depend on forEachAsync@2.x and foreachasync@3.x. Because the casing but not name of foreachasync changed across versions, it seems like it might be confusing npm and not properly installing the right versions.
I was able to fix this in our project by explicitly depending on foreachasync@^3.0.0
.
来源:https://stackoverflow.com/questions/38468730/using-fs-extra-copyrecursive-gives-a-typeerror-foreachasync-is-not-a-function