Laravel error_npm

问题描述 投票:1回答:1

我一直在做一个laravel项目。在项目中,我必须进行视频聊天。我使用https://github.com/PHPJunior/laravel-video-chat?ref=madewithlaravel.com和laravel-echo-server。我尝试了几种解决方案,但它们都没有奏效。当我运行命令时: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 [email protected] requires a peer of webpack@^3.0.0 || ^4.0.0 but none
is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^4.0.0 but none is installe
d. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@>=2 but none is installed
. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^3.
0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself
.
npm WARN [email protected] 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 [email protected] 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 [email protected] requires a peer of webpack@^4.
0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^4.0.0 but none
is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of [email protected] but none is installe
d. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of webpack@^4.0.0 but none is
 installed. You must install peer dependencies yourself.
npm WARN [email protected] 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 [email protected] requires a peer of webpack@^4.0.0 but none
 is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (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
javascript laravel npm laravel-mix
1个回答
0
投票

你使用npm install安装了npm,还检查了你的错误日志文件。

© www.soinside.com 2019 - 2024. All rights reserved.