fs.copyFile is not a function

Situation
Describe your problem here
I keep getting the following error message when attempting to run npm run build:

'rtl:setup' errored after 2.7 ms
[12:39:25] TypeError: fs.copyFile is not a function
    at Gulp.<anonymous> (/storage/openemr_master/gulpfile.js:178:8)
    at module.exports (/storage/openemr_master/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/storage/openemr_master/node_modules/orchestrator/index.js:273:3)
    at Gulp.Orchestrator._runStep (/storage/openemr_master/node_modules/orchestrator/index.js:214:10)
    at Gulp.Orchestrator.start (/storage/openemr_master/node_modules/orchestrator/index.js:134:8)
    at runNextSet (/storage/openemr_master/node_modules/run-sequence/index.js:124:15)
    at Gulp.onTaskEnd (/storage/openemr_master/node_modules/run-sequence/index.js:102:4)
    at emitOne (events.js:101:20)
    at Gulp.emit (events.js:188:7)
    at Gulp.Orchestrator._emitTaskDone (/storage/openemr_master/node_modules/orchestrator/index.js:264:8)

OpenEMR Version
I’m using OpenEMR version git master

Browser:
I’m using: Firefox 69.0

Operating System
I’m using: CentOS 7.0

Logs
Did you check the logs? Was there anything pertinent in them? Paste them here (surround with three backticks (```) for readability
The error message occurred while installing. As I read it, the fs object has not been instantiated correctly and so does not have the requested function. If there are additional logs that could be helpful, I’m happy to provide information from them.

hi @aaronchantrill What is your npm and node (or nodejs) version?

npm --version
node --version

Thank you for responding, Brady.

$ npm --version
3.10.10
$ node --version
v6.17.1

I was able to set everything up on Debian Buster:

$ npm --version
5.8.0
$ node --version
v10.15.2

So your instinct is probably correct, the versions of npm and node are too old. These are the versions that come from yum on Centos 7.

I tried updating using npm itself, but that failed spectacularly, so I tried using nvm to install the latest version of node as described here:

That worked (although I plan to study the downloaded install.sh script more closely and re-write it before applying it in production), but when I ran npm install again, it generated a lot of errors about missing functions in Nan. Finally I used nvm to install node version 10.15.2 (it was at 12.11.0), and that got me up and running.

A couple of additional notes for anyone else having similar problems on Centos 7:

Along the way I discovered that I needed to install the build essentials for Centos, so had to run
sudo yum groupinstall "Development Tools"

I also ended up switching selinux to permissive mode for the installation steps, although I’m not sure if that was required.
sudo setenforce 0

As always, thank you for the help.

1 Like