forwardemail / email-templates

Create, preview (browser/iOS Simulator), and send custom email templates for Node.js. Made for @forwardemail, @ladjs, @cabinjs, @spamscanner, and @breejs.
https://forwardemail.net/docs/send-emails-with-node-js-javascript
MIT License
3.67k stars 337 forks source link

Since 5.0.1: Error: Cannot find module ‘juice’ #331

Closed ibc closed 5 years ago

ibc commented 6 years ago
Error: Cannot find module ‘juice’
   at Function.Module._resolveFilename (module.js:547:15)
   at Function.Module._load (module.js:474:25)
   at Module.require (module.js:596:17)
   at require (internal/module.js:11:18)
   at Object.<anonymous> (/service/node_modules/juice-resources-promise/index.js:1:77)
   at Module._compile (module.js:652:30)
   at Object.Module._extensions..js (module.js:663:10)
   at Module.load (module.js:565:32)
   at tryModuleLoad (module.js:505:12)
   at Function.Module._load (module.js:497:3)
   at Module.require (module.js:596:17)
   at require (internal/module.js:11:18)
   at Object.<anonymous> (/service/node_modules/email-templates/lib/index.js:39:24)
   at Module._compile (module.js:652:30)
   at Object.Module._extensions..js (module.js:663:10)
   at Module.load (module.js:565:32)

My app dependencies:

"dependencies": {
    "ejs": "^2.6.1",
    "email-templates": "^5.0.1",
    "nodemailer": "^4.6.8"
  },
ibc commented 6 years ago

Interesting:

"dependencies": {
    "juice": "^5.0.0",
    "juice-resources-promise": "^0.0.2",
}
"devDependencies": {
  "juice": "^4.1.1"
}

It seems to me that this is making NPM crazy (just wondering).

Confirmed that MY_APP/node_modules/juice does NOT exist.

ibc commented 6 years ago

In fact, the "Cannot find module ‘juice’" does not happen if I install my app dependencies with npm install, but it DOES happen if I do npm install --production.

Hwoever, it does not happen with yarn install --production.

$ node -v
v8.11.3

$ npm -v
6.4.1

$ yarn -v
1.7.0
ibc commented 6 years ago

Confirmed that this is a fuxxxxxing bug in NPM, and just happens if npm i --production is called and the main add does have juice 4.xx' within itsdevDependencies`. A complete no-sense.

niftylettuce commented 5 years ago

fix will be published in new version shortly, thanks

niftylettuce commented 5 years ago

email-templates@5.0.2 has been released to npm