Apologies if there is something obvious I'm missing, I've actually never encountered this error before using npm:
C:\work\spark3>npm install mailparser npm http GET https://registry.npmjs.org/mailparser npm http 304 https://registry.npmjs.org/mailparser npm http GET https://registry.npmjs.org/encoding npm http GET https://registry.npmjs.org/mime npm http GET https://registry.npmjs.org/mimelib npm http GET https://registry.npmjs.org/iconv npm http 304 https://registry.npmjs.org/mime npm http 304 https://registry.npmjs.org/mimelib npm http 304 https://registry.npmjs.org/encoding npm http 304 https://registry.npmjs.org/iconv npm http GET https://registry.npmjs.org/iconv-lite/0.2.7 npm http GET https://registry.npmjs.org/addressparser npm http 304 https://registry.npmjs.org/iconv-lite/0.2.7 npm http 304 https://registry.npmjs.org/addressparser > iconv@2.0.4 install C:\work\spark3\node_modules\mailparser\node_modules\iconv > node-gyp rebuild C:\work\spark3\node_modules\mailparser\node_modules\iconv>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild gyp ERR! configure error gyp ERR! stack Error: spawn ENOENT gyp ERR! stack at errnoException (child_process.js:975:11) gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:766:34) gyp ERR! System Windows_NT 6.1.7600 gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" gyp ERR! cwd C:\work\spark3\node_modules\mailparser\node_modules\iconv gyp ERR! node -v v0.10.4 gyp ERR! node-gyp -v v0.9.5 gyp ERR! not ok npm WARN optional dep failed, continuing iconv@2.0.4 mailparser@0.3.4 node_modules\mailparser ├── mime@1.2.9 ├── mimelib@0.2.12 (addressparser@0.1.3) └── encoding@0.1.6 (iconv-lite@0.2.7)
I have tried the following on my Windows machine after scouring the web:
The problem is actually with the iconv module which, according to its GitHub page, "may or may not work with Windows".
Since mailparser declares it as an optional dependency, try downloading the mailparser source and remove iconv from package.json as a dependency.