Problems with gulp init
wayne-dooley-nih opened this issue · 6 comments
Hi all -- I'm attempting to complete the tutorial, and I'm running into a snag at part two, step 7. When I attempt the 'npx gulp init', I receive the following errors:
~/uswds-tutorial dooleywm $ npx gulp init
[16:12:26] Using gulpfile ~/uswds-tutorial/gulpfile.js
[16:12:26] Starting 'init'...
[16:12:26] Starting 'theme'...
Copying USWDS theme files to ./_theme
[16:12:26] 'theme' errored after 858 μs
[16:12:26] TypeError: paths.src.theme.replaceAll is not a function
at theme (/Users/dooleywm/uswds-tutorial/node_modules/@uswds/compile/gulpfile.js:87:43)
at bound (domain.js:416:15)
at runBound (domain.js:427:12)
at asyncRunner (/Users/dooleywm/uswds-tutorial/node_modules/async-done/index.js:55:18)
at processTicksAndRejections (internal/process/task_queues.js:77:11)
[16:12:26] 'init' errored after 2.8 ms
Here's the contents of my gulpfile.js:
const uswds = require('@uswds/compile');
uswds.paths.dist.theme = './_theme';
exports.init = uswds.init;
exports.compile = uswds.compile;
exports.watch = uswds.watch;
Appreciate your help!
I am running into the same problem.
@wayne-dooley-nih I searched the error messaging we were getting: TypeError: paths.src.theme.replaceAll is not a function
and came upon this page. It said that often this error is received when the node.js version is not up-to-date.
So then I ran node --version
and saw that I was on version 14 of node.js and that there is version 17.4.0 released, so I followed the directions here to update my version of node.js, then tried running npx gulp init
and then it worked!
Successful output:
Myers19Mac2:uswds-tutorial kristen.myers$ npx gulp init
[14:52:26] Using gulpfile ~/Documents/GitHub/uswds-tutorial/gulpfile.js
[14:52:26] Starting 'init'...
[14:52:26] Starting 'theme'...
Copying USWDS theme files to ./_theme
[14:52:26] Starting 'fonts'...
[14:52:26] Starting 'images'...
[14:52:26] Starting 'js'...
Copying USWDS fonts to ./assets/uswds/fonts
Copying USWDS images to ./assets/uswds/img
Copying USWDS JavaScript to ./assets/uswds/js
[14:52:27] Finished 'js' after 211 ms
[14:52:27] Finished 'theme' after 223 ms
[14:52:27] Finished 'fonts' after 390 ms
[14:52:28] Finished 'images' after 1.51 s
[14:52:28] Starting 'buildSass'...
[14:52:28] Starting 'buildSprite'...
I hope this helps you!
@kristenmyers -- Yep, that was it! I upgraded node version, and all is working well. Thanks for the help!
Thank you for sharing @kristenmyers!
completed the tutorial using node16 and didn't run into any issues.
btw, you can run nvm use
at the root of any project that has a .nvmrc
and know that it will be set to the correct version.
@thisisdano this should be safe to close.