haraka / node-address-rfc2821

RFC2821 Email Address parser (from Haraka)
https://www.npmjs.com/package/address-rfc2821
13 stars 6 forks source link

Cannot find module `./grammar.js` #35

Closed justinbaltazar closed 3 years ago

justinbaltazar commented 3 years ago

Was unsure where to put this. I opened another issue in the core Haraka plugin repo: https://github.com/haraka/node-address-rfc2821/issues/32

Describe the bug Import error with new grammar.js compiled file.

Expected behavior Haraka should run.

Observed behavior

internal/modules/cjs/loader.js:969
  throw err;
  ^
Error: Cannot find module './grammar.js'
Require stack:
- /usr/local/lib/node_modules/Haraka/node_modules/address-rfc2821/index.js
- /usr/local/lib/node_modules/Haraka/connection.js
- /usr/local/lib/node_modules/Haraka/logger.js
- /usr/local/lib/node_modules/Haraka/haraka.js
- /usr/local/lib/node_modules/Haraka/bin/haraka
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
    at Function.Module._load (internal/modules/cjs/loader.js:842:27)
    at Module.require (internal/modules/cjs/loader.js:1026:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/Haraka/node_modules/address-rfc2821/index.js:6:46)
    at Module._compile (internal/modules/cjs/loader.js:1138:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
    at Module.load (internal/modules/cjs/loader.js:986:32)
    at Function.Module._load (internal/modules/cjs/loader.js:879:14)
    at Module.require (internal/modules/cjs/loader.js:1026:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/Haraka/node_modules/address-rfc2821/index.js',
    '/usr/local/lib/node_modules/Haraka/connection.js',
    '/usr/local/lib/node_modules/Haraka/logger.js',
    '/usr/local/lib/node_modules/Haraka/haraka.js',
    '/usr/local/lib/node_modules/Haraka/bin/haraka'
  ]
}

Steps To Reproduce Install a fresh copy of Haraka via npm. Run haraka -i test and then haraka -c test

System Info:

Haraka Haraka.js — Version: 2.8.26
Node v12.18.2
OS Linux instance-1 5.8.0-1011-gcp haraka/Haraka#11-Ubuntu SMP Thu Nov 5 16:51:36 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
openssl OpenSSL 1.1.1f 31 Mar 2020

Additional context Looks to be related to this commit and the use of this new grammar.js library.

justinbaltazar commented 3 years ago

For help with debugging, compiling https://github.com/haraka/node-address-rfc2821 separately successfully generates the grammar.js file with the postinstall hook.

Manually removing all the contents of the folder /usr/local/lib/node_modules/Haraka/node_modules/address-rfc2821/ and replacing it with all the contents of the manually compiled node-address-rfc2821 package fixes the issue.

Might be a problem with the package postinstall hook not placing grammar.js in the proper directory? Hmmm

msimerson commented 3 years ago

duplicate of #32