leemunroe / grunt-email-workflow

A Grunt workflow for designing and testing responsive HTML email templates with SCSS.
MIT License
3.05k stars 339 forks source link

Cannot find module "balanced-match" #102

Closed rmercer33 closed 5 years ago

rmercer33 commented 5 years ago

I cloned the repository, created secrets.json, did npm install and ran $ grunt, it failed with this message:

Loading "Gruntfile.js" tasks...ERROR
>> Error: Cannot find module 'balanced-match'
Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

Thanks for helping!

taeo commented 5 years ago

Hey @rmercer33 - Can you provide these details:

Maybe try removing node_modules and rm -rf node_modules from your project directory and then reinstall npm install?

rmercer33 commented 5 years ago

Hi Taeo,

Thanks for your help.

I'm using Mac OS 10.14.2 Node: 8.10.0 npm: 6.5.0

There were no errors during install but there were many vulnerabilities, 37 high and 2 critical. On my first install I ran npm audit fix to fix them.

I just started over, deleted everything and re cloned the repository, ran npm install and this time I DID NOT run npm audit fix. Re-created secrets.json (forgot to back it up first).

Running grunt resulted in the same error.

master* grunt
Loading "Gruntfile.js" tasks...ERROR
>> Error: Unable to read "secrets.json" file (Error code: ENOENT).
Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.

Thanks again.

taeo commented 5 years ago

Looks like npm audit fix was the culprit the first go round. I've created task https://github.com/leemunroe/grunt-email-workflow/issues/103 to track the vulnerabilities.

Second go round, your error says >> Error: Unable to read "secrets.json" file (Error code: ENOENT).. You'll notice below I had the same error and ran echo "{}" >> secrets.json, then grunt ran as expected.

Here's my full output on Mac running node 8.10.0 and npm 6.5.0

mattbain@sole ~/S/_/grunt-email-workflow> npm --version
6.5.0
mattbain@sole ~/S/_/grunt-email-workflow> node --version
v8.10.0
mattbain@sole ~/S/_/grunt-email-workflow> npm install

> node-sass@4.8.3 install /Users/mattbain/Sites/_tools/grunt-email-workflow/node_modules/node-sass
> node scripts/install.js

Cached binary found at /Users/mattbain/.npm/node-sass/4.8.3/darwin-x64-57_binding.node

> node-sass@4.8.3 postinstall /Users/mattbain/Sites/_tools/grunt-email-workflow/node_modules/node-sass
> node scripts/build.js

Binary found at /Users/mattbain/Sites/_tools/grunt-email-workflow/node_modules/node-sass/vendor/darwin-x64-57/binding.node
Testing binary
Binary is fine

> gifsicle@3.0.4 postinstall /Users/mattbain/Sites/_tools/grunt-email-workflow/node_modules/gifsicle
> node lib/install.js

  ✔ gifsicle pre-build test passed successfully

> jpegtran-bin@3.2.0 postinstall /Users/mattbain/Sites/_tools/grunt-email-workflow/node_modules/jpegtran-bin
> node lib/install.js

  ✔ jpegtran pre-build test passed successfully

> mozjpeg@5.0.0 postinstall /Users/mattbain/Sites/_tools/grunt-email-workflow/node_modules/mozjpeg
> node lib/install.js

  ✔ mozjpeg pre-build test passed successfully

> optipng-bin@3.1.4 postinstall /Users/mattbain/Sites/_tools/grunt-email-workflow/node_modules/optipng-bin
> node lib/install.js

  ✔ optipng pre-build test passed successfully
added 1944 packages from 665 contributors and audited 20458 packages in 23.712s
found 287 vulnerabilities (139 low, 109 moderate, 37 high, 2 critical)
  run `npm audit fix` to fix them, or `npm audit` for details
👉🏼mattbain@sole ~/S/_/grunt-email-workflow> grunt
Loading "Gruntfile.js" tasks...ERROR
>> Error: Unable to read "secrets.json" file (Error code: ENOENT).
Warning: Task "default" not found. Use --force to continue.

Aborted due to warnings.
👉🏼mattbain@sole ~/S/_/grunt-email-workflow> echo "{}" >> secrets.json
mattbain@sole ~/S/_/grunt-email-workflow> grunt

(node:87724) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
Running "clean:clean" (clean) task
>> 0 paths cleaned.

Running "sass:dist" (sass) task

Running "assemble:pages" (assemble) task
Assembling dist/branded.html OK
Assembling dist/components.html OK
Assembling dist/transaction.html OK
>> 3 pages assembled.

Running "juice:your_target" (juice) task
File "dist/branded.html" created.
File "dist/components.html" created.
File "dist/transaction.html" created.

Running "imagemin:dynamic" (imagemin) task
Minified 1 image (saved 854 B - 12.4%)

Running "replace:src_images" (replace) task
>> Unable to match 1 pattern.
>> 1 replacement in 3 files.

Done.
mattbain@sole ~/S/_/grunt-email-workflow> 
rmercer33 commented 5 years ago

Oh man, thanks Taeo. I didn't even notice the error message was different. I had a file called 'secret.json' - singular. I changed that and it's working fine.

The 'npm audit fix' was the problem.

Thank you!!