symfony / ux

Symfony UX initiative: a JavaScript ecosystem for Symfony
https://ux.symfony.com/
MIT License
784 stars 275 forks source link

The file "@symfony/ux-chartjs/package.json" could not be found #1412

Open Dumorya opened 5 months ago

Dumorya commented 5 months ago

Issue

When I run the command line "npm run build", I get the following error:

> build
> encore production --progress

Running webpack ...

99% done plugins FriendlyErrorsWebpackPlugin ERROR  Failed to compile with 1 errors                                                                                                                                                                                                                                                                             10:24:04

 error  in ./assets/controllers.json                                                                                                                                                                                                                                                                                10:24:04

Module build failed (from ../../nodevenv/public_html/xxx/16/lib/node_modules/@symfony/stimulus-bridge/dist/webpack/loader.js):
Error: The file "@symfony/ux-chartjs/package.json" could not be found. Try running "yarn install --force".
    at createControllersModule (/home/xxx/nodevenv/public_html/xxx/16/lib/node_modules/@symfony/stimulus-bridge/dist/webpack/loader.js:46:19)
    at Object.loader (/home/xxx/nodevenv/public_html/xxx/16/lib/node_modules/@symfony/stimulus-bridge/dist/webpack/loader.js:106:43)

Entrypoint app = runtime.9a71ee5d.js 842.cb9a3ca0.js app.97de1fbb.css app.0095513b.js 7 auxiliary assets
webpack compiled with 1 error

This package.json file in fact doesn't exist. As recommended, I ran the command line "npm i --force", but it didn't change anything.

Main package.json

{
    "devDependencies": {
        "@hotwired/stimulus": "^3.0.0",
        "@popperjs/core": "^2.11.0",
        "@symfony/stimulus-bridge": "^3.2.0",
        "@symfony/stimulus-bundle": "file:vendor/symfony/stimulus-bundle/assets",
        "@symfony/ux-chartjs": "file:vendor/symfony/ux-chartjs/assets",
        "@symfony/webpack-encore": "^1.7.0",
        "bootstrap": "^5.1.3",
        "chart.js": "^3.4.1",
        "core-js": "^3.20.0",
        "jquery": "^3.6.0",
        "regenerator-runtime": "^0.13.2",
        "sass": "^1.45.0",
        "sass-loader": "^12.4.0",
        "webpack-notifier": "^1.15.0"
    },
    "license": "UNLICENSED",
    "private": true,
    "scripts": {
        "dev-server": "encore dev-server",
        "dev": "encore dev",
        "watch": "encore dev --watch",
        "build": "encore production --progress"
    },
    "dependencies": {
        "@babel/plugin-proposal-class-properties": "^7.18.6"
    }
}

Composer.json

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "stable",
    "prefer-stable": true,
    "require": {
        "php": ">=8.0.0",
        "ext-ctype": "*",
        "ext-ftp": "*",
        "ext-iconv": "*",
        "beberlei/doctrineextensions": "^1.3",
        "composer/package-versions-deprecated": "1.11.99.4",
        "doctrine/annotations": "^1.0",
        "doctrine/doctrine-bundle": "^2.4",
        "doctrine/doctrine-migrations-bundle": "^3.2.2",
        "doctrine/orm": "^2.10",
        "easycorp/easyadmin-bundle": "^4.0",
        "karser/karser-recaptcha3-bundle": "^0.1.24",
        "phpdocumentor/reflection-docblock": "^5.3",
        "phpoffice/phpspreadsheet": "^1.23",
        "phpseclib/phpseclib": "^3.0",
        "sensio/framework-extra-bundle": "^6.1",
        "symfony/asset": "6.0.*",
        "symfony/console": "6.0.*",
        "symfony/dotenv": "6.0.*",
        "symfony/expression-language": "6.0.*",
        "symfony/flex": "^1.3.1",
        "symfony/form": "6.0.*",
        "symfony/framework-bundle": "6.0.*",
        "symfony/http-client": "6.0.*",
        "symfony/intl": "6.0.*",
        "symfony/mailer": "6.0.*",
        "symfony/mailjet-mailer": "6.0.*",
        "symfony/mime": "6.0.*",
        "symfony/monolog-bundle": "^3.1",
        "symfony/notifier": "6.0.*",
        "symfony/process": "6.0.*",
        "symfony/property-access": "6.0.*",
        "symfony/property-info": "6.0.*",
        "symfony/proxy-manager-bridge": "6.0.*",
        "symfony/requirements-checker": "^2.0",
        "symfony/runtime": "6.0.*",
        "symfony/security-bundle": "6.0.*",
        "symfony/serializer": "6.0.*",
        "symfony/stimulus-bundle": "^2.13",
        "symfony/string": "6.0.*",
        "symfony/translation": "6.0.*",
        "symfony/twig-bundle": "6.0.*",
        "symfony/ux-chartjs": "^2.0",
        "symfony/validator": "6.0.*",
        "symfony/web-link": "6.0.*",
        "symfony/webpack-encore-bundle": "^1.17",
        "symfony/yaml": "6.0.*",
        "symfonycasts/reset-password-bundle": "^1.11",
        "symfonycasts/verify-email-bundle": "^1.5",
        "twig/extra-bundle": "^2.12|^3.0",
        "twig/intl-extra": "^3.3",
        "twig/twig": "^2.12|^3.0"
    },
    "require-dev": {
        "doctrine/doctrine-fixtures-bundle": "^3.4",
        "phpunit/phpunit": "^9.5",
        "rector/rector": "^0.15.7",
        "symfony/browser-kit": "6.0.*",
        "symfony/css-selector": "6.0.*",
        "symfony/debug-bundle": "6.0.*",
        "symfony/maker-bundle": "^1.0",
        "symfony/phpunit-bridge": "^5.3",
        "symfony/stopwatch": "6.0.*",
        "symfony/web-profiler-bundle": "6.0.*"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true,
        "allow-plugins": {
            "symfony/flex": true,
            "symfony/runtime": true
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-php72": "*"
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%": "symfony-cmd",
            "requirements-checker": "script"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "allow-contrib": false,
            "require": "6.0.*"
        }
    }
}
weaverryan commented 5 months ago

Hmm. Does the vendor/symfony/ux-chartjs/assets directory exist that the entry in package.json is referring to? Ultimately, you're supposed to end up with a node_modules/@symfony/ux-chartjs/ directory with files inside.

Dumorya commented 5 months ago

There actually is an assets directory with a dist directory and a package.json file inside.

Dumorya commented 5 months ago

@weaverryan Hi, any chance you have some news about it? :)

Dumorya commented 3 months ago

Hi @weaverryan , it turns out there is no ux-chartjs directory created in node_modules/@symfony. Do you have any idea why?

smnandre commented 3 months ago

Hi @Dumorya !

I used only your composer.json file to reproduce

composer install 
npm install --force

The files are then correctly found in the node_modules/@symfony/ux-charts/dist directory

➜  ux-npm ls -la node_modules/@symfony/
total 0
drwxr-xr-x    5 simonandre  staff    160 20 mar 15:01 .
drwxr-xr-x  450 simonandre  staff  14400 20 mar 15:01 ..
drwxr-xr-x    8 simonandre  staff    256 20 mar 15:01 stimulus-bridge
lrwxr-xr-x    1 simonandre  staff     38 20 mar 15:01 ux-chartjs -> ../../vendor/symfony/ux-chartjs/assets
drwxr-xr-x    9 simonandre  staff    288 20 mar 15:01 webpack-encore
➜  ux-npm ls -la node_modules/@symfony/ux-chartjs/dist
total 16
drwxr-xr-x  4 simonandre  staff   128 22 fév 13:15 .
drwxr-xr-x  4 simonandre  staff   128 22 fév 13:15 ..
-rw-r--r--  1 simonandre  staff   280 22 fév 13:15 controller.d.ts
-rw-r--r--  1 simonandre  staff  1918 22 fév 13:15 controller.js

You may have missed a recipe.

Try to update them with composer recipes maybe ?

For information that is the content of the generated packages.json file

{
    "devDependencies": {
        "@babel/core": "^7.17.0",
        "@babel/preset-env": "^7.16.0",
        "@hotwired/stimulus": "^3.0.0",
        "@symfony/stimulus-bridge": "^3.2.0",
        "@symfony/ux-chartjs": "file:vendor/symfony/ux-chartjs/assets",
        "@symfony/webpack-encore": "^4.0.0",
        "chart.js": "^3.4.1 || ^4.0",
        "core-js": "^3.23.0",
        "regenerator-runtime": "^0.13.9",
        "webpack": "^5.74.0",
        "webpack-cli": "^4.10.0",
        "webpack-notifier": "^1.15.0"
    },
    "license": "UNLICENSED",
    "private": true,
    "scripts": {
        "dev-server": "encore dev-server",
        "dev": "encore dev",
        "watch": "encore dev --watch",
        "build": "encore production --progress"
    }
}

So maybe the stimulus-bridge version to change ?