Nodemailer: Postinstall problems 6.4.5

Created on 11 Mar 2020  路  13Comments  路  Source: nodemailer/nodemailer

Hi there,
when using version 6.4.4 the post installation works fine.

However, updating to version 6.4.5 will show the following error:

Thanks in advance

Most helpful comment

Hi andris9,

I am no expert, however, this is what the error log says. Maybe this is of any help

100 verbose stack Error: [email protected] postinstall: node -e "try{require('./postinstall')}catch(e){}"
100 verbose stack spawn ENOENT
100 verbose stack at ChildProcess. (/opt/plesk/node/12/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
100 verbose stack at ChildProcess.emit (events.js:200:13)
100 verbose stack at maybeClose (internal/child_process.js:1021:16)
100 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
101 verbose pkgid [email protected]
102 verbose cwd /var/www/vhosts/hosting107605.a2f15.netcup.net/srv.huwaldroether.de/dist
103 verbose Linux 4.9.0-0.bpo.9-amd64
104 verbose argv "/opt/plesk/node/12/bin/node" "/opt/plesk/node/12/bin/npm" "install"
105 verbose node v12.4.0
106 verbose npm v6.9.0
107 error file sh
108 error code ELIFECYCLE
109 error errno ENOENT
110 error syscall spawn
111 error [email protected] postinstall: node -e "try{require('./postinstall')}catch(e){}"
111 error spawn ENOENT
112 error Failed at the [email protected] postinstall script.

The strange thing is that versions 6.4.0 - 6.4.4 worked just fine.

All 13 comments

Same situation for me.

Can not reproduce. Could you try figuring out why this happens (maybe some system specific requirements) and propose a fix?

Hi andris9,

I am no expert, however, this is what the error log says. Maybe this is of any help

100 verbose stack Error: [email protected] postinstall: node -e "try{require('./postinstall')}catch(e){}"
100 verbose stack spawn ENOENT
100 verbose stack at ChildProcess. (/opt/plesk/node/12/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
100 verbose stack at ChildProcess.emit (events.js:200:13)
100 verbose stack at maybeClose (internal/child_process.js:1021:16)
100 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
101 verbose pkgid [email protected]
102 verbose cwd /var/www/vhosts/hosting107605.a2f15.netcup.net/srv.huwaldroether.de/dist
103 verbose Linux 4.9.0-0.bpo.9-amd64
104 verbose argv "/opt/plesk/node/12/bin/node" "/opt/plesk/node/12/bin/npm" "install"
105 verbose node v12.4.0
106 verbose npm v6.9.0
107 error file sh
108 error code ELIFECYCLE
109 error errno ENOENT
110 error syscall spawn
111 error [email protected] postinstall: node -e "try{require('./postinstall')}catch(e){}"
111 error spawn ENOENT
112 error Failed at the [email protected] postinstall script.

The strange thing is that versions 6.4.0 - 6.4.4 worked just fine.

It seems that node binary is not available in default path

furthermore, there are no release notes for 6.4.5

I faced the same issue

Hi andris9,

I am no expert, however, this is what the error log says. Maybe this is of any help

100 verbose stack Error: [email protected] postinstall: node -e "try{require('./postinstall')}catch(e){}"
100 verbose stack spawn ENOENT
100 verbose stack at ChildProcess. (/opt/plesk/node/12/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
100 verbose stack at ChildProcess.emit (events.js:200:13)
100 verbose stack at maybeClose (internal/child_process.js:1021:16)
100 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
101 verbose pkgid [email protected]
102 verbose cwd /var/www/vhosts/hosting107605.a2f15.netcup.net/srv.huwaldroether.de/dist
103 verbose Linux 4.9.0-0.bpo.9-amd64
104 verbose argv "/opt/plesk/node/12/bin/node" "/opt/plesk/node/12/bin/npm" "install"
105 verbose node v12.4.0
106 verbose npm v6.9.0
107 error file sh
108 error code ELIFECYCLE
109 error errno ENOENT
110 error syscall spawn
111 error [email protected] postinstall: node -e "try{require('./postinstall')}catch(e){}"
111 error spawn ENOENT
112 error Failed at the [email protected] postinstall script.

The strange thing is that versions 6.4.0 - 6.4.4 worked just fine.

Yep. I installed 6.4.4 without an issue. Thanks!

Not sure if this helps but I was hitting a similar issue due to the introduction of that postinstall script. After digging a little more, I found it was because I was building with an Alpine image and I use root inside the container to install my packages.
https://github.com/linuxserver/docker-baseimage-alpine/issues/47
I set ENV npm_config_unsafe_perm=true in my Dockerfile to workaround

Make sure that node binary is available in default path or disable scripts: npm install --ignore-scripts

Same problem here doing npm install nodemailer. Installed npm install [email protected] and worked it.

I think this issue is not resolved and should be reopened.

Why does 6.4.5 exist if there are no release notes (thanks to @jakeleventhal)? Why does 6.4.4 work perfectly without error? This shouldn't be ignored considering how big this project is, and how many of us are clearly struggling with this issue.
I hope my reasons are clear, and to anybody looking for help, install 6.4.4, but we can't just ignore this issue.

Thanks,
Luka S.

Even though this project may seem big, it is not a community project but my personal project that I have been building from my spare time for the last 10 years. CHANGELOG does not include every released version mostly because I haven't been always consistent and ofter forget to add an entry.

Post-install script does not work if node binary is not available from global $PATH. There are multiple solutions to overcome this:

  • Make sure that node binary is available from global $PATH (preferred solution)
  • Fork Nodemailer and remove post-install script from package.json
  • I have a sponsorship tier in Github that once reached, also removes the post-install script
  • Do not run npm scripts when installing modules (npm install --ignore-scripts)
  • Use an alternative module like emailjs that does not have such post-install script.

Hi andris9,

I am no expert, however, this is what the error log says. Maybe this is of any help

100 verbose stack Error: [email protected] postinstall: node -e "try{require('./postinstall')}catch(e){}"
100 verbose stack spawn ENOENT
100 verbose stack at ChildProcess. (/opt/plesk/node/12/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
100 verbose stack at ChildProcess.emit (events.js:200:13)
100 verbose stack at maybeClose (internal/child_process.js:1021:16)
100 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
101 verbose pkgid [email protected]
102 verbose cwd /var/www/vhosts/hosting107605.a2f15.netcup.net/srv.huwaldroether.de/dist
103 verbose Linux 4.9.0-0.bpo.9-amd64
104 verbose argv "/opt/plesk/node/12/bin/node" "/opt/plesk/node/12/bin/npm" "install"
105 verbose node v12.4.0
106 verbose npm v6.9.0
107 error file sh
108 error code ELIFECYCLE
109 error errno ENOENT
110 error syscall spawn
111 error [email protected] postinstall: node -e "try{require('./postinstall')}catch(e){}"
111 error spawn ENOENT
112 error Failed at the [email protected] postinstall script.

The strange thing is that versions 6.4.0 - 6.4.4 worked just fine.

Thank you I have got that error with npm i nodemailer but not: npm i [email protected]

Was this page helpful?
0 / 5 - 0 ratings