nystudio107 / generator-craftplugin

generator-craftplugin is a Yeoman generator for Craft CMS plugins
MIT License
73 stars 30 forks source link

"Callback must be a function" error on Node.js v10.0.0 #57

Closed Saboteur777 closed 4 years ago

Saboteur777 commented 6 years ago

Running the generator resulted in the following error with Node.js v10.0.0:

[ Configuring ]
+ Creating Craft plugin folder billingoforcraftcommerce
events.js:167
      throw er; // Unhandled 'error' event
      ^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:124:9)
    at Object.fs.writeFile (fs.js:1244:14)
    at child.configuring (/usr/lib/node_modules/generator-craftplugin/app/index.js:294:12)
    at /usr/lib/node_modules/generator-craftplugin/node_modules/yeoman-generator/lib/base.js:429:16
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)
Emitted 'error' event at:
    at /usr/lib/node_modules/generator-craftplugin/node_modules/yeoman-generator/lib/base.js:437:14
    at runCallback (timers.js:696:18)
    at tryOnImmediate (timers.js:667:5)
    at processImmediate (timers.js:649:5)

According to the documentation a 4th argument is needed on fs.writeFile (a callback). It was missing until now. After this PR everything seems normal with Node.js v10.0.0, too.

khalwat commented 4 years ago

Fixed this with writeFileSync() -> https://github.com/nystudio107/generator-craftplugin/commit/3d22216593d84ec809c6087115d5b5eeeb40312e