Dealogic / cloc-vsts-extension

Build task for Visual Studio Team Services (VSTS) to count lines of code.
MIT License
5 stars 2 forks source link

TypeError: fs.copyFile is not a function #18

Open ScottHutchinson opened 3 years ago

ScottHutchinson commented 3 years ago

TFS 2018 on Windows Server with node.js Latest LTS Version: 12.18.3 (includes npm 6.14.6):

2020-07-22T23:12:09.8281274Z task display name: cloc --windows . 2020-07-22T23:12:09.8286442Z working folder: C:\Msft_test\AgentSmith_work\1\s 2020-07-22T23:12:09.8344899Z cloc-cli download url: file://C:/cloc/cloc-1.86.exe 2020-07-22T23:12:09.8345511Z arguments: --windows . 2020-07-22T23:12:09.8345591Z Downloading cloc.exe from: 2020-07-22T23:12:09.8345752Z Url { 2020-07-22T23:12:09.8345822Z protocol: 'file:', 2020-07-22T23:12:09.8345890Z slashes: true, 2020-07-22T23:12:09.8345973Z auth: null, 2020-07-22T23:12:09.8346037Z host: 'c', 2020-07-22T23:12:09.8346101Z port: null, 2020-07-22T23:12:09.8346166Z hostname: 'c', 2020-07-22T23:12:09.8346493Z hash: null, 2020-07-22T23:12:09.8346560Z search: null, 2020-07-22T23:12:09.8346624Z query: null, 2020-07-22T23:12:09.8346711Z pathname: '/cloc/cloc-1.86.exe', 2020-07-22T23:12:09.8346785Z path: '/cloc/cloc-1.86.exe', 2020-07-22T23:12:09.8346858Z href: 'file://c/cloc/cloc-1.86.exe' } 2020-07-22T23:12:09.8346939Z Copying file from '//c/cloc/cloc-1.86.exe' 2020-07-22T23:12:09.8383559Z ##[error]cloc --windows . failed 2020-07-22T23:12:09.8403635Z ##[error]TypeError: fs.copyFile is not a function 2020-07-22T23:12:09.8403837Z TypeError: fs.copyFile is not a function 2020-07-22T23:12:09.8403946Z at Object.downloadClocCli [as default] (C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\clocCliDownloader.js:16:20) 2020-07-22T23:12:09.8404106Z at C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\index.js:33:40 2020-07-22T23:12:09.8404193Z at next (native) 2020-07-22T23:12:09.8404295Z at C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\index.js:7:71 2020-07-22T23:12:09.8404401Z at __awaiter (C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\index.js:3:12) 2020-07-22T23:12:09.8404530Z at run (C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\index.js:15:12) 2020-07-22T23:12:09.8404642Z at Object. (C:\Msft_test\AgentSmith_work_tasks\cloc_7b598338-cf0d-4c3f-acc2-4967b6202533\1.2.1\index.js:47:1) 2020-07-22T23:12:09.8404751Z at Module._compile (module.js:570:32) 2020-07-22T23:12:09.8404831Z at Object.Module._extensions..js (module.js:579:10) 2020-07-22T23:12:09.8404918Z at Module.load (module.js:487:32)

dparvin commented 3 years ago

It seems to download the file from the webserver OK, but when you have the file local, and specify it in the task as you described, the task produces an error like this one. The other problem I have had is when I download the file from the server every time, I sometimes get the agent to crash and restart. I believe it has to do with Windows Security and the EXE getting blocked as it is getting downloaded. When you then try to execute the counting, the agent crashes.

ScottHutchinson commented 3 years ago

"A build task for Visual Studio Team Services (VSTS) made with ♥ by dealogic" but maintained by nobody, apparently.

jkanczler commented 3 years ago

Unfortunately, it's true. I don't have time anymore to maintain this project. I left Dealogic almost two years ago when Dealogic bought by ION Group. Because of the acquisition, I believe Dealogic is not using this tool anymore.

dparvin commented 3 years ago

Is it possible that the problem is we don't have the right version of node installed on the machine where the agent is installed to run the task?

ScottHutchinson commented 3 years ago

The node dependency seems to be completely undocumented. So who knows.