Laravel error_npm - PullRequest
       26

Laravel error_npm

0 голосов
/ 20 февраля 2019

Я делал проект Laravel.В проекте я должен поставить видео-чат.Я использовал https://github.com/PHPJunior/laravel-video-chat?ref=madewithlaravel.com с laravel-echo-сервером.Я попробовал пару решений, но ни одно из них не сработало.Когда я запускаю команду: npm run dev, я получаю это:

> @ development c:\xampp\htdocs\lsapp
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress
--hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

c:\xampp\htdocs\lsapp\node_modules\webpack-cli\bin\cli.js:231
                                throw err;
                                ^

TypeError: Cannot read property 'js' of undefined
    at Object.<anonymous> (c:\xampp\htdocs\lsapp\webpack.mix.js:14:5)
    at Module._compile (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-c
ompile-cache.js:178:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-compile-c
ache.js:159:20)
    at Object.<anonymous> (c:\xampp\htdocs\lsapp\node_modules\laravel-mix\setup\
webpack.config.js:12:1)
    at Module._compile (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-c
ompile-cache.js:178:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-compile-c
ache.js:159:20)
    at WEBPACK_OPTIONS (c:\xampp\htdocs\lsapp\node_modules\webpack-cli\bin\conve
rt-argv.js:115:13)
    at requireConfig (c:\xampp\htdocs\lsapp\node_modules\webpack-cli\bin\convert
-argv.js:117:6)
    at c:\xampp\htdocs\lsapp\node_modules\webpack-cli\bin\convert-argv.js:124:17

    at Array.forEach (<anonymous>)
    at module.exports (c:\xampp\htdocs\lsapp\node_modules\webpack-cli\bin\conver
t-argv.js:122:15)
    at yargs.parse (c:\xampp\htdocs\lsapp\node_modules\webpack-cli\bin\cli.js:22
8:39)
    at Object.parse (c:\xampp\htdocs\lsapp\node_modules\yargs\yargs.js:567:18)
    at c:\xampp\htdocs\lsapp\node_modules\webpack-cli\bin\cli.js:206:8
    at Object.<anonymous> (c:\xampp\htdocs\lsapp\node_modules\webpack-cli\bin\cl
i.js:500:3)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (c:\xampp\htdocs\lsapp\node_modules\webpack\bin\webpac
k.js:156:2)
    at Module._compile (internal/modules/cjs/loader.js:689:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin
/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/we
bpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Dimitrije\AppData\Roaming\npm-cache\_logs\2019-02-20T10_31
_27_631Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Dimitrije\AppData\Roaming\npm-cache\_logs\2019-02-20T10_31
_27_681Z-debug.log

Также вот мой package.json

{
"private": true,
"scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "npm run development -- --watch",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},
"devDependencies": {
    "axios": "^0.18",
    "bootstrap": "^4.0.0",
    "cross-env": "^5.1",
    "jquery": "^3.2",
    "laravel-mix": "^4.0.7",
    "lodash": "^4.17.5",
    "popper.js": "^1.12",
    "resolve-url-loader": "^2.3.1",
    "sass": "^1.15.2",
    "sass-loader": "^7.1.0",
    "vue": "^2.5.17",
    "webpack-config": "^7.5.0"
},
"dependencies": {
    "webpack": "^4.29.5"
}
}

Composer.json:

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
    "php": ">=5.6.4",
    "laravel/framework": "5.4.*",
    "laravel/tinker": "~1.0",
    "laravelcollective/html": "^5.4.0",
    "unisharp/laravel-ckeditor": "^4.6",
    "webpatser/laravel-uuid": "^3.0"
},
"require-dev": {
    "fzaninotto/faker": "~1.4",
    "mockery/mockery": "0.9.*",
    "phpunit/phpunit": "~5.7"
},
"autoload": {
    "classmap": [
        "database"
    ],
    "psr-4": {
        "App\\": "app/"
    }
},
"autoload-dev": {
    "psr-4": {
        "Tests\\": "tests/"
    }
},
"scripts": {
    "post-root-package-install": [
        "php -r \"file_exists('.env') || copy('.env.example', '.env');\""
    ],
    "post-create-project-cmd": [
        "php artisan key:generate"
    ],
    "post-install-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postInstall",
        "php artisan optimize"
    ],
    "post-update-cmd": [
        "Illuminate\\Foundation\\ComposerScripts::postUpdate",
        "php artisan optimize"
    ]
},
"config": {
    "preferred-install": "dist",
    "sort-packages": true,
    "optimize-autoloader": true
}
}

Обновление: когда я изменился в webpack.mix.js

const { mix } = require('laravel-mix');
to
const mix = require('laravel-mix');

Я получил это:

    > cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress
--hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

The system cannot find the path specified.
        Additional dependencies must be installed. This will only take a moment.


        Running: npm install vue-template-compiler --save-dev --production=false


npm WARN rm not removing c:\xampp\htdocs\lsapp\node_modules\.bin\regjsparser.cmd
 as it wasn't installed by c:\xampp\htdocs\lsapp\node_modules\regjsparser
npm WARN rm not removing c:\xampp\htdocs\lsapp\node_modules\.bin\regjsparser as
it wasn't installed by c:\xampp\htdocs\lsapp\node_modules\regjsparser
npm WARN rm not removing c:\xampp\htdocs\lsapp\node_modules\.bin\json5.cmd as it
 wasn't installed by c:\xampp\htdocs\lsapp\node_modules\json5
npm WARN rm not removing c:\xampp\htdocs\lsapp\node_modules\.bin\json5 as it was
n't installed by c:\xampp\htdocs\lsapp\node_modules\json5
npm WARN rm not removing c:\xampp\htdocs\lsapp\node_modules\.bin\jsesc.cmd as it
 wasn't installed by c:\xampp\htdocs\lsapp\node_modules\jsesc
npm WARN rm not removing c:\xampp\htdocs\lsapp\node_modules\.bin\jsesc as it was
n't installed by c:\xampp\htdocs\lsapp\node_modules\jsesc
npm WARN rm not removing c:\xampp\htdocs\lsapp\node_modules\.bin\cssesc.cmd as i
t wasn't installed by c:\xampp\htdocs\lsapp\node_modules\cssesc
npm WARN rm not removing c:\xampp\htdocs\lsapp\node_modules\.bin\cssesc as it wa
sn't installed by c:\xampp\htdocs\lsapp\node_modules\cssesc
npm notice created a lockfile as package-lock.json. You should commit this file.

npm WARN sass-loader@7.1.0 requires a peer of webpack@^3.0.0 || ^4.0.0 but none
is installed. You must install peer dependencies yourself.
npm WARN css-loader@1.0.1 requires a peer of webpack@^4.0.0 but none is installe
d. You must install peer dependencies yourself.
npm WARN babel-loader@8.0.5 requires a peer of webpack@>=2 but none is installed
. You must install peer dependencies yourself.
npm WARN extract-text-webpack-plugin@4.0.0-beta.0 requires a peer of webpack@^3.
0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself
.
npm WARN file-loader@2.0.0 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0
 but none is installed. You must install peer dependencies yourself.
npm WARN friendly-errors-webpack-plugin@1.7.0 requires a peer of webpack@^2.0.0
|| ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yo
urself.
npm WARN optimize-css-assets-webpack-plugin@5.0.1 requires a peer of webpack@^4.
0.0 but none is installed. You must install peer dependencies yourself.
npm WARN terser-webpack-plugin@1.2.2 requires a peer of webpack@^4.0.0 but none
is installed. You must install peer dependencies yourself.
npm WARN webpack-cli@3.2.3 requires a peer of webpack@4.x.x but none is installe
d. You must install peer dependencies yourself.
npm WARN webpack-dev-server@3.1.14 requires a peer of webpack@^4.0.0 but none is
 installed. You must install peer dependencies yourself.
npm WARN vue-loader@15.6.4 requires a peer of webpack@^4.1.0 || ^5.0.0-0 but non
e is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware@3.4.0 requires a peer of webpack@^4.0.0 but none
 is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fse
vents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)

        Okay, done. The following packages have been installed and saved to your
 package.json dependencies list:

        - vue-template-compiler

c:\xampp\htdocs\lsapp\node_modules\webpack-cli\bin\cli.js:231
                                throw err;
                                ^

Error: Cannot find module 'webpack/lib/RequestShortener'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-compile-c
ache.js:159:20)
    at Object.<anonymous> (c:\xampp\htdocs\lsapp\node_modules\friendly-errors-we
bpack-plugin\src\core\extractWebpackError.js:4:26)
    at Module._compile (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-c
ompile-cache.js:178:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-compile-c
ache.js:159:20)
    at Object.<anonymous> (c:\xampp\htdocs\lsapp\node_modules\friendly-errors-we
bpack-plugin\src\core\transformErrors.js:3:22)
    at Module._compile (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-c
ompile-cache.js:178:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-compile-c
ache.js:159:20)
    at Object.<anonymous> (c:\xampp\htdocs\lsapp\node_modules\friendly-errors-we
bpack-plugin\src\friendly-errors-plugin.js:6:25)
    at Module._compile (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-c
ompile-cache.js:178:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-compile-c
ache.js:159:20)
    at Object.<anonymous> (c:\xampp\htdocs\lsapp\node_modules\friendly-errors-we
bpack-plugin\index.js:2:37)
    at Module._compile (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-c
ompile-cache.js:178:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (c:\xampp\htdocs\lsapp\node_modules\v8-compile-cache\v8-compile-c
ache.js:159:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin
/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/we
bpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Dimitrije\AppData\Roaming\npm-cache\_logs\2019-02-20T11_17
_55_042Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Dimitrije\AppData\Roaming\npm-cache\_logs\2019-02-20T11_17
_55_404Z-debug.log

1 Ответ

0 голосов
/ 20 февраля 2019

Вы установили npm, используя npm install, а также проверьте файл журнала ошибок.

...