如何在远程服务器上使用puppeteer运行应用

时间:2019-07-11 06:47:10

标签: laravel-5 puppeteer

在laravel 5.8应用程序中,我设法生成了带Spatie / Browsershot的文件,然后下载了, 但是要在我的Ubuntu 18本地运行它,我已经运行了

items.push({label: item._, value: item.$.value});

我收到错误消息:

npm i puppeteer@next

我在https://github.com/GoogleChrome/puppeteer/issues/2119分支机构发现了这个决定。

但是在我的服务器上安装应用程序后,出现了错误消息:

Error Output: ================ module.js:549 throw err; ^ Error: Cannot find module 'puppeteer' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load 

安装我需要运行的laravel应用

The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/var/www/html/votes/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/tmp\/0046339001562826751\/index.html","action":"pdf","options":{"path":"generate_profile_card_ohTcbPxIiVNo5CUp8nIDJHbO8mKU2MhwCq4UFIbB_filename.pdf","args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false,"printBackground":true}}'" failed. Exit Code: 1(General error) Working directory: /var/www/html/votes/public Output: ================ Error Output: ================ module.js:549 throw err; ^ Error: Cannot find module 'puppeteer' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object.<anonymous> (/var/www/html/votes/vendor/spatie/browsershot/bin/browser.js:1:81) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3)

但不是

composer install 

是吗?

但是我必须在模板的/layouts/frontend.blade.php中包含/public/js/app.js文件。 我想p必须在此文件中?

我的composer.json:

npm install

package.json:

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": "^7.1.3",
        "alaouy/youtube": "^2.2",
        "aloha/twilio": "^4.0",
        "arrilot/laravel-widgets": "^3.12",
        "cviebrock/eloquent-sluggable": "^4.5",
        "davejamesmiller/laravel-breadcrumbs": "5.x",
        "doctrine/dbal": "^2.8",
        "elasticquent/elasticquent": "dev-master",
        "facebook/graph-sdk": "^5.7",
        "fideloper/proxy": "^4.0",
        "google/apiclient": "^2.2",
        "intervention/image": "^2.4",
        "itsgoingd/clockwork": "^3.0",
        "jrean/laravel-user-verification": "^7.0",
        "laravel/framework": "5.8.*",
        "laravel/socialite": "^3.2",
        "laravel/tinker": "^1.0",
        "laravelium/sitemap": "^3.1",
        "maatwebsite/excel": "^3.1",
        "mews/captcha": "^2.2",
        "mews/purifier": "^2.1",
        "paypal/rest-api-sdk-php": "*",
        "proengsoft/laravel-jsvalidation": ">2.2.0",
        "s-ichikawa/laravel-sendgrid-driver": "~2.0",
        "snowfire/beautymail": "dev-master",
        "socialiteproviders/instagram": "^3.0",
        "spatie/browsershot": "^3.27",
        "spatie/laravel-activitylog": "^3.1",
        "spatie/laravel-backup": "^6.1",
        "spatie/laravel-feed": "^2.1",
        "spatie/laravel-image-optimizer": "^1.4",
        "spatie/laravel-newsletter": "^4.2",
        "spatie/laravel-sitemap": "^5.3",
        "spatie/laravel-tags": "^2.1",
        "spipu/html2pdf": "^5.2",
        "symfony/psr-http-message-bridge": "^1.2",
        "themsaid/laravel-mail-preview": "^2.0",
        "unisharp/laravel-filemanager": "^1.9",
        "wboyz/laravel-enum": "^0.2.1",
        "willvincent/feeds": "1.1.*",
        "yajra/laravel-datatables-oracle": "^9.0.0",
        "zendframework/zend-diactoros": "^2.1"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.1",
        "filp/whoops": "^2.0",
        "fzaninotto/faker": "^1.4",
        "mockery/mockery": "^1.0",
        "nunomaduro/collision": "^2.0",
        "orangehill/iseed": "^2.6",
        "phpunit/phpunit": "^7.0",
        "xethron/migrations-generator": "^2.0"
    },
    "autoload": {
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "psr-4": {
            "App\\": "app/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "extra": {
        "laravel": {
            "dont-discover": [
            ]
        }
    },
    "scripts": {
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate"
        ],
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover"
        ],


        "post-update-cmd": [
            "php artisan vendor:publish --provider=\"Proengsoft\\JsValidation\\JsValidationServiceProvider\" --tag=public --force"
        ]

    },
    "config": {
        "preferred-install": "dist",
        "sort-packages": true,
        "optimize-autoloader": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

如何在服务器(ubuntu 18 inder Digital Ocean)上修复此错误?

0 个答案:

没有答案