question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot resolve dependency 'core-js/modules/es6.array.copy-within'

See original GitHub issue

🐛 bug report

Parcel CLI cannot resolve the core-js@3’s array module. Seems like it is looking for the wrong module. It is looking for “core-js/modules/es6.array.copy-within”, while I have “core-js/modules/es.array.copy-within” in my “node_modules”.

🎛 Configuration (.babelrc, package.json, cli command)

package.json:

{
    "name": "parcel_test",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "dev": "parcel watch src/app.html -d app --public-url .",
        "build": "parcel build src/app.html -d app --public-url . --no-content-hash"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "dependencies": {
        "core-js": "^3.1.4",
        "vue": "^2.6.10"
    },
    "devDependencies": {
        "parcel-bundler": "^1.12.3",
        "@babel/core": "^7.5.5",
        "@vue/component-compiler-utils": "^3.0.0",
        "vue-template-compiler": "^2.6.10",
        "vue-hot-reload-api": "^2.3.3"
    }
}

CLI command: parcel build src/app.html -d app --public-url . --no-content-hash

I don’t have a babel config.

🤔 Expected Behavior

Should compile

😯 Current Behavior

parcel_test/src/index.js: Cannot resolve dependency 'core-js/modules/es6.array.find-index'
    at Resolver.resolve (/Users/hsong/workspace/JS/parcel_test/node_modules/parcel-bundler/src/Resolver.js:71:17)
    at async Bundler.resolveAsset (/Users/hsong/workspace/JS/parcel_test/node_modules/parcel-bundler/src/Bundler.js:433:18)
    at async Bundler.resolveDep (/Users/hsong/workspace/JS/parcel_test/node_modules/parcel-bundler/src/Bundler.js:484:14)
    at async /Users/hsong/workspace/JS/parcel_test/node_modules/parcel-bundler/src/Bundler.js:608:26
    at async Promise.all (index 4)
    at async Bundler.loadAsset (/Users/hsong/workspace/JS/parcel_test/node_modules/parcel-bundler/src/Bundler.js:599:21)
    at async /Users/hsong/workspace/JS/parcel_test/node_modules/parcel-bundler/src/Bundler.js:610:13
    at async Promise.all (index 0)
    at async Bundler.loadAsset (/Users/hsong/workspace/JS/parcel_test/node_modules/parcel-bundler/src/Bundler.js:599:21)
    at async Bundler.processAsset (/Users/hsong/workspace/JS/parcel_test/node_modules/parcel-bundler/src/Bundler.js:557:5)
    at async PromiseQueue._runJob (/Users/hsong/workspace/JS/parcel_test/node_modules/parcel-bundler/src/utils/PromiseQueue.js:48:7)

💁 Possible Solution

Workaround: use @babel/polyfill or core-js@2 instead.

🔦 Context

Build apps.

💻 Code Sample

N/A

🌍 Your Environment

Software Version(s)
Parcel parcel-bundler 1.12.3
Node 12.6.0
npm/Yarn 6.10.2
Operating System macOS Mojave 10.14.6

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:8
  • Comments:5

github_iconTop GitHub Comments

16reactions
NikhilVermacommented, Nov 30, 2019

@fnick851 Use import 'core-js/stable'; instead.

See: https://babeljs.io/docs/en/babel-polyfill

2reactions
babak-bekhradcommented, Nov 23, 2020

Hi, you can use this version of core-js for fixing that problem. yarn add core-js@2.6.5

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Error: Can't resolve 'core-js/es6'
I found possible answer. You have core-js version 3.0, and this version doesn't have separate folders ...
Read more >
WebpackError: Cannot find module 'core-js/modules/es6.array ...
Look into the node_modules/core-js/modules/ folder and found es.array.iterator.js instead. The es6.array namespace is from core-js 2 while core-js 3 moved to es ...
Read more >
Can't resolve 'core-js/modules/es6.array.copy-within' in
Module not found: Can't resolve 'core-js/modules/es6.array.copy-within' in ...
Read more >
core-js/README.md - UNPKG
* `modules` path is internal API, does not inject all required dependencies and can be changed in minor or patch releases. Use it...
Read more >
core-js - npm
In the library version, we can't pollute prototypes of native constructors ... Modules es6.array.from , es6.array.of , es6.array.copy-within ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found