1

Всем привет, Создал новый Laravel проект

$ php artisan --version 
Laravel Framework 5.5.18

$ node -v
v7.10.0
$ npm -v 
4.2.0

Но я получил ошибки:

$ npm run watch

> @ watch /mnt/_work_sdb8/wwwroot/lar/vtasks
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js

sh: 1: cross-env: not found

npm ERR! Linux 4.4.0-62-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "watch"
npm ERR! node v7.10.0
npm ERR! npm  v4.2.0
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! @ watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the @ watch script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs 
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls 
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/serge/.npm/_logs/2017-10-23T07_18_03_617Z-debug.log

Но в файле 2017-10-23T07_18_03_617Z-debug.log :

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'run', 'watch' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle @~prewatch: @
6 silly lifecycle @~prewatch: no script for prewatch, continuing
7 info lifecycle @~watch: @
8 verbose lifecycle @~watch: unsafe-perm in lifecycle true
9 verbose lifecycle @~watch: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/mnt/_work_sdb8/wwwroot/lar/vtasks/node_modules/.bin:/home/serge/bin:/home/serge/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
10 verbose lifecycle @~watch: CWD: /mnt/_work_sdb8/wwwroot/lar/vtasks
11 silly lifecycle @~watch: Args: [ '-c',
11 silly lifecycle   'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js' ]
12 info lifecycle @~watch: Failed to exec watch script
13 verbose stack Error: @ watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
13 verbose stack spawn ENOENT
13 verbose stack     at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:33:16)
13 verbose stack     at emitTwo (events.js:106:13)
13 verbose stack     at ChildProcess.emit (events.js:194:7)
13 verbose stack     at maybeClose (internal/child_process.js:899:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
14 verbose pkgid @
15 verbose cwd /mnt/_work_sdb8/wwwroot/lar/vtasks
16 error Linux 4.4.0-62-generic
17 error argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "watch"
18 error node v7.10.0
19 error npm  v4.2.0
20 error file sh
21 error code ELIFECYCLE
22 error errno ENOENT
23 error syscall spawn
24 error @ watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
24 error spawn ENOENT
25 error Failed at the @ watch script 'cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js'.
25 error Make sure you have the latest version of node.js and npm installed.
25 error If you do, this is most likely a problem with the  package,
25 error not with npm itself.
25 error Tell the author that this fails on your system:
25 error     cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
25 error You can get information on how to open an issue for this project with:
25 error     npm bugs
25 error Or if that isn't available, you can get their info via:
25 error     npm owner ls
25 error There is likely additional logging output above.
26 verbose exit [ 1, true ]

Я что-то упустил и как это исправить ?

  Спасибо !

1
  • 1
    ссори, а npm install и npm update выполняли?
    – maxkrasnov
    23 окт 2017 в 7:37

2 ответа 2

1

Ответа на комментарий не получил, но попробуйте в корне проекта выполнить:

npm install

или

npm update
1

Предполагаю что вы пользуетесь ОС Windows

в файле package.json замените содержимое scripts на

"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": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "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 --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
},

Ваш ответ

By clicking “Отправить ответ”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Всё ещё ищете ответ? Посмотрите другие вопросы с метками или задайте свой вопрос.