stimulus-bridge icon indicating copy to clipboard operation
stimulus-bridge copied to clipboard

"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.

Open shakaran opened this issue 4 years ago • 7 comments

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.

shakaran avatar Aug 17 '21 16:08 shakaran

Hi, you need to install core-js dependency.

Kocal avatar Aug 17 '21 17:08 Kocal

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.

weaverryan avatar Nov 16 '21 18:11 weaverryan

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

MichaelMackus avatar Dec 03 '21 22:12 MichaelMackus

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.

Cartman34 avatar Jun 23 '22 13:06 Cartman34

@Cartman34 I've tried to offer some help about the package over on https://github.com/symfony/webpack-encore/issues/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).

weaverryan avatar Jun 23 '22 14:06 weaverryan

@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 ?

Cartman34 avatar Jun 24 '22 07:06 Cartman34

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!

pacoVela avatar Sep 22 '22 22:09 pacoVela