Jimp: 0.3.3 : Cannot find module 'core-js/modules/es6.array.is-array'

Created on 11 Aug 2018  Â·  55Comments  Â·  Source: oliver-moran/jimp

jimp 0.3.3
ubuntu 18

package.json:
json { "name": "foo", "version": "0.0.1", "devDependencies": { "jimp": "0.3.3" } }

app.js:
node "use strict"; const jimp = require("jimp");

run it:
node app.js

result is an error with:
Error: Cannot find module 'core-js/modules/es6.array.is-array'

Most helpful comment

@hipstersmoothie @oliver-moran
problem has been solved!
npm i -s [email protected]
I've installed specific 2.5.7 core-js version and jimp works well :)
core-js v3 throws error as above.

All 55 comments

same here

Same here:

$ npm ls jimp
[email protected] /Users/dev/git/my-project
└── [email protected]

$ npm -v
6.2.0

$ node -v
v10.8.0

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.13.6
BuildVersion:   17G65

Have no error when using Jimp v0.3.2 ...

I'm having trouble reproducing this.

EDIT: nvm some other modules must have installed that on my test project :(

Quick fix until next release:

yarn add @babel/polyfill

Did my above fix help until a release can get out?

@hipstersmoothie I don't use yarn, so don't know if that works, sorry. But I downgraded to 0.3.2 which works for me.

Can you verify the babel polyfill? you can instead just

npm i @babel/polyfill

npm i and yarn add are the same thing

@hipstersmoothie I tried that and it works. Might be useful for those using those tools, thanks.

I'll wait for the next version though.

I'm gonna keep this open til a release happens

Thought my node installation was broken, was going insane. Thanks for the quick release.

I'm trying to get it release ASAP. But I don't have the key yet. In the meantime please install @babel/polyfill and jimp should work as expected

I've published the release but the problem seems to be still there in 0.3.4.

screen shot 2018-08-11 at 21 39 11

This is from my smoke test as follows:

var Jimp = require("jimp");

// open a file called "lenna.png"
Jimp.read("lenna.png", function (err, lenna) {
    if (err) throw err;
    lenna.resize(256, 256)            // resize
         .quality(60)                 // set JPEG quality
         .greyscale()                 // set greyscale
         .write("lena-small-bw.jpg"); // save
});

It got added as a dev dep so it wasn't installed 😢

still Error: Cannot find module 'core-js/modules/es6.array.is-array'...

I just pushed a commit that should resolve the issue. https://github.com/oliver-moran/jimp/commit/97ed2a524ea4263af2581dd20578f166d714fd34 @oliver-moran

@hipstersmoothie sorry but still Error: Cannot find module 'core-js/modules/es6.array.is-array'

@johnnykramer I know I think the above commit should fix the problem.

@hipstersmoothie unfortunately, last commit didn't...

My branch here seems to work. I ran

yarn add hipstersmoothie/jimp#test

and running the above code yields no errors.

npm uninstall --save jimp
npm install --save hipstersmoothie/jimp#test

And still Error: Cannot find module 'core-js/modules/es6.array.is-array'

did you rm -rf node_modules/

@johnnykramer what version of node are you using?

@hipstersmoothie

> node -v
> v8.11.3

yes, i've done rm -rf node_modules/

I've published 0.3.5. Smoke test works again from my end.

I'm also using v8.11.3.

I just tested with v8.11.3 also and it seems to work

@johnnykramer can you test with v0.3.5 ?

@oliver-moran @hipstersmoothie
node v10.8.0 also Error: Cannot find module 'core-js/modules/es6.array.is-array'

I can no longer reproduce the issue on any version of node. Could you throw a sample project together.

this is my setup right now:

{
  "name": "jimp-testing-project",
  "version": "1.0.0",
  "main": "src/index.js",
  "dependencies": {
    "jimp": "^0.3.5"
  }
}
var Jimp = require("jimp");

// open a file called "lenna.png"
Jimp.read("./exampleImages/lenna.png", function (err, lenna) {
    if (err) throw err;
    lenna.resize(256, 256)            // resize
         .quality(60)                 // set JPEG quality
         .greyscale()                 // set greyscale
         .write("lena-small-bw.jpg"); // save
});
nvm use 10.8.0
rm -rf node_modules  
npm i --save [email protected]
node src/index.js

@hipstersmoothie

{
  "name": "test-project",
  "version": "1.0.0",
  "main": "index.js",
  "dependencies": {
    "jimp": "^0.3.5"
  }
}
const jimp = require('jimp');

async function saveImage(imageData, outputPath) {
  jimp.read(imageData)
    .then(img => img.write(outputPath));
}

@johnnykramer still no problems. can you check in node_modules for @babel/polyfill? the issue is that should be in node modules to supply the core-js polyfills. @babel/polyfill should also be a dependency in jimp

maybe its a lock file problem? try deleting any of those if you have them

@hipstersmoothie yes, @babel/polyfill present in the jimp's dependencies

screen shot 2018-08-11 at 3 28 51 pm

can i see the full stack trace?

core-js is in node modules too?

> [email protected] start /home/ec2-user/environment/test-app
> node index.js

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module 'core-js/modules/es6.array.is-array'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)
    at Object.<anonymous> (/home/ec2-user/environment/test-app/node_modules/jimp/dist/index.js:3:1)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ec2-user/.npm/_logs/2018-08-11T22_41_35_169Z-debug.log

core-js also installed.
@hipstersmoothie

Okay I'm a little baffled. I can't reproduce this at all. Is this within a AWS instance?

The dependancies are installed so I don't know why it can't resolve them...

does it work if you add @babel/polyfill or core-js directly?

How about what npm version are you using?

If you are on npm@2 it could be a problem https://github.com/babel/babel-preset-env/issues/162

I get the same issue when i am using npm < 3

it is cloud9 on the aws ec2 instance.
npm v6.2.0

And i've installed @babel/polyfill and core-js manually — still not working! :(

I have no experience with aws. You have any ideas? I'll search around for similar issues

you definitely have core-js/modules/es6.array.is-array installed and babel is for sure trying to include it. maybe you could globally install it on the instance? (I'm just taking guesses at this point)

@hipstersmoothie @oliver-moran
problem has been solved!
npm i -s [email protected]
I've installed specific 2.5.7 core-js version and jimp works well :)
core-js v3 throws error as above.

Awesome!

now to figure out why core-js 3 was being installed

I'm looking at the lock file and see no reference to core-js v3

So on a clean install it defaults to core-js@3-ish?

These are my only entries for core-js in my yarn.lock

"@babel/polyfill@^7.0.0-rc.1":
  version "7.0.0-rc.1"
  resolved "https://registry.yarnpkg.com/@babel/polyfill/-/polyfill-7.0.0-rc.1.tgz#c78e17e64c42cd6a2f5d8edf0f20e18213c0d74d"
  dependencies:
    core-js "^2.5.7"
    regenerator-runtime "^0.11.1"

and in the package-lock.json

    "@babel/polyfill": {
      "version": "7.0.0-rc.1",
      "resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.0.0-rc.1.tgz",
      "integrity": "sha512-x6s1nu32T0Ayzh/d0SXB4UPIZNcK7Oc01tmZQEhBVwFeOF+ynUlyS4b+zKX1kfbjD7o4qF6PXvDXLRX6i28hsA==",
      "requires": {
        "core-js": "2.5.7",
        "regenerator-runtime": "0.11.1"
      }
    },

what does your lock file look like?

@hipstersmoothie Thanks for fixing this.

Off topic, what terminal are you using in that image?

@lonix1 Integrated vscode terminal, oh-my-zsh, with my custom theme https://github.com/hipstersmoothie/PowerlevelHipstersmoothie

🤘Weed leaves and flames 🤘

npm i -s [email protected] works for me :)

Thanks @johnnykramer

Was this page helpful?
0 / 5 - 0 ratings

Related issues

DylanPiercey picture DylanPiercey  Â·  4Comments

Favna picture Favna  Â·  4Comments

SamuelZhaoY picture SamuelZhaoY  Â·  3Comments

fatihturgut picture fatihturgut  Â·  4Comments

master-of-null picture master-of-null  Â·  3Comments