ashtuchkin / iconv-lite

Convert character encodings in pure javascript.
MIT License
3.08k stars 282 forks source link

Cannot find module './utf32' #260

Closed jonasdev closed 4 years ago

jonasdev commented 4 years ago

My node server is running fine locally, but when I deploy to Heroku, I get an error message

package.json
"iconv-lite": "^0.6.2",
"engines": {
    "node": "14.4.0",
    "npm": "6.14.5"
  }

Here is a snippet of my node server

const iconv = require("iconv-lite");

Promise.all(
    array.map((el) =>
      fetch(el.url)
        .then((res) => res.arrayBuffer())
        .then((arrayBuffer) => iconv.decode(Buffer.from(arrayBuffer), "iso-8859-1"))
        .then((data) => console.log(data))
        .catch(err => console.log(err)
...

Like I mentioned, iconv-lite is decoding correctly when I run the server locally. But when I deploy to Heroku, it will catch an error for each element in the array

heroku logs --tail
2020-10-25T10:15:55.680941+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1089:19)
2020-10-25T10:15:55.680941+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:73:18)
2020-10-25T10:15:55.680941+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/iconv-lite/encodings/index.js:7:5)
2020-10-25T10:15:55.680942+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1200:30)
2020-10-25T10:15:55.680942+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
2020-10-25T10:15:55.680943+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:1049:32)
2020-10-25T10:15:55.680943+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:937:14)
2020-10-25T10:15:55.680943+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1089:19) {
2020-10-25T10:15:55.680944+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-10-25T10:15:55.680944+00:00 app[web.1]: requireStack: [
2020-10-25T10:15:55.680945+00:00 app[web.1]: '/app/node_modules/iconv-lite/encodings/index.js',
2020-10-25T10:15:55.680945+00:00 app[web.1]: '/app/node_modules/iconv-lite/lib/index.js',
2020-10-25T10:15:55.680946+00:00 app[web.1]: '/app/index.js'
2020-10-25T10:15:55.680946+00:00 app[web.1]: ]
2020-10-25T10:15:55.680946+00:00 app[web.1]: }
2020-10-25T10:15:55.799217+00:00 app[web.1]: err Error: Cannot find module './utf32'
2020-10-25T10:15:55.799225+00:00 app[web.1]: Require stack:
2020-10-25T10:15:55.799226+00:00 app[web.1]: - /app/node_modules/iconv-lite/encodings/index.js
2020-10-25T10:15:55.799227+00:00 app[web.1]: - /app/node_modules/iconv-lite/lib/index.js
2020-10-25T10:15:55.799227+00:00 app[web.1]: - /app/index.js
2020-10-25T10:15:55.799227+00:00 app[web.1]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
2020-10-25T10:15:55.799228+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:898:27)
2020-10-25T10:15:55.799228+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1089:19)
2020-10-25T10:15:55.799229+00:00 app[web.1]: at require (internal/modules/cjs/helpers.js:73:18)
2020-10-25T10:15:55.799229+00:00 app[web.1]: at Object.<anonymous> (/app/node_modules/iconv-lite/encodings/index.js:7:5)
2020-10-25T10:15:55.799229+00:00 app[web.1]: at Module._compile (internal/modules/cjs/loader.js:1200:30)
2020-10-25T10:15:55.799230+00:00 app[web.1]: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
2020-10-25T10:15:55.799230+00:00 app[web.1]: at Module.load (internal/modules/cjs/loader.js:1049:32)
2020-10-25T10:15:55.799231+00:00 app[web.1]: at Function.Module._load (internal/modules/cjs/loader.js:937:14)
2020-10-25T10:15:55.799231+00:00 app[web.1]: at Module.require (internal/modules/cjs/loader.js:1089:19) {
2020-10-25T10:15:55.799232+00:00 app[web.1]: code: 'MODULE_NOT_FOUND',
2020-10-25T10:15:55.799232+00:00 app[web.1]: requireStack: [
2020-10-25T10:15:55.799232+00:00 app[web.1]: '/app/node_modules/iconv-lite/encodings/index.js',
2020-10-25T10:15:55.799233+00:00 app[web.1]: '/app/node_modules/iconv-lite/lib/index.js',
2020-10-25T10:15:55.799233+00:00 app[web.1]: '/app/index.js'
2020-10-25T10:15:55.799233+00:00 app[web.1]: ]