Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"core-js/modules/es.object.set-prototype-of.js". This file can not be found, please check it for typos or update it if the file got moved. #47

Open
shakaran opened this issue Aug 17, 2021 · 7 comments

Comments

@shakaran
Copy link

shakaran commented Aug 17, 2021

I am having this errors, not sure how to fix this:

$encore dev watch
Running webpack ...

 ERROR  Failed to compile with 12 errors                                                                                                                

Module build failed: Module not found:
"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/es.object.set-prototype-of.js".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/es.object.get-prototype-of.js".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/es.reflect.construct.js".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/es.object.create.js".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/es.object.define-property.js".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/es.symbol.js".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/es.symbol.description.js".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/es.object.to-string.js".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/es.symbol.iterator.js".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/es.array.iterator.js".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/es.string.iterator.js".
This file can not be found, please check it for typos or update it if the file got moved.

"./node_modules/@symfony/stimulus-bridge/lazy-controller-loader.js!./assets/controllers/hello_controller.js" contains a reference to the file "core-js/modules/web.dom-collections.iterator.js".
This file can not be found, please check it for typos or update it if the file got moved.

I only have the file:

assets/controllers/hello_controller.js

import { Controller } from 'stimulus';

/*
 * This is an example Stimulus controller!
 *
 * Any element with a data-controller="hello" attribute will cause
 * this controller to be executed. The name "hello" comes from the filename:
 * hello_controller.js -> "hello"
 *
 * Delete this file or adapt it for your use!
 */
export default class extends Controller {
    connect() {
        this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
    }
}

I have to comment all the export default for solve the encore problems.

@Kocal
Copy link
Member

Kocal commented Aug 17, 2021

Hi, you need to install core-js dependency.

@weaverryan
Copy link
Member

Installing core-js should fix it, but I'm confused how this is happening to people. I believe that what causes this is the combination of (A) no core-js install and (B) enabling useBuiltIns: 'usage' for Babel - https://github.com/symfony/recipes/blob/a624d3bf1def68bbd2d542b3a99216c0af090552/symfony/webpack-encore-bundle/1.9/webpack.config.js#L54

You should get both of these things automatically with the WebpackEncoreBundle recipe. It seems like some people are getting the webpack.config.js code (part B) but not part A.... but I don't know how.

@MichaelMackus
Copy link

I was having this issue (as well as a bunch of other issues installing webpack encore in a Symfony app recently updated to 4.4). I was following the instructions here: https://symfony.com/doc/current/frontend/encore/installation.html

@Cartman34
Copy link

Cartman34 commented Jun 23, 2022

I am having this issue on a Sf 6.1 with Webpack Encore, even after I installed core-js.
In the package.json file, I got
"core-js": "^3.23.2",
But this is still failing to build when using something like Object.entries()
I would mention that I am using controllers from a local bundle and I have some trouble with Flex that is not auto-reciping the bundle.
Last week, this was working, I don't what's changed.

@weaverryan
Copy link
Member

@Cartman34 I've tried to offer some help about the package over on symfony/webpack-encore#1129 - my guess is that the error is related to working on a package. Specifically, you may not be "building" a dist version of your JS files in your bundle, and then because they live in node_modules of your app, the files are not being handled by babel in the normal way (as webpack/babel typically expects files in node_modules to already be in a built form).

@Cartman34
Copy link

@weaverryan You are totally right, I am a JS developer but not a Node one :D
I understand ressources from package will compiled for publishing but to work locally, it supposed I run one npm run watch per bundle/package, is this the answer ?

I don't even know I was using babel, webpack uses it implicitly ?
So, core-js is ok for project but there is a different compilation scope for each package ?

How do you to develop locally a JS package ?

@pacoVela
Copy link

Installing core-js should fix it, but I'm confused how this is happening to people. I believe that what causes this is the combination of (A) no core-js install and (B) enabling useBuiltIns: 'usage' for Babel - https://github.com/symfony/recipes/blob/a624d3bf1def68bbd2d542b3a99216c0af090552/symfony/webpack-encore-bundle/1.9/webpack.config.js#L54

You should get both of these things automatically with the WebpackEncoreBundle recipe. It seems like some people are getting the webpack.config.js code (part B) but not part A.... but I don't know how.

Same error here. I've installed it a dozen times with no issue... but this time npm install fails because the package.json file is not merged with an existing one.
In my case, the package.json only contains:

{
  "devDependencies": {
    "bootstrap": "^5.2.1"
  }
}

;) wanting to get hands on the frontend too early this time?

So, just copy the contents from package.json and run npm install again...

hope it helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants