我对Laravel和Vue有问题。当我尝试使用npm run watch编译所有内容时,我得到了它们(它突然停止工作了):
Additional dependencies must be installed. This will only take a moment.
Running: yarn add vue-template-compiler --dev --production=false
/bin/sh: yarn: command not found
/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/cli.js:244
throw err;
^
Error: Command failed: yarn add vue-template-compiler --dev --production=false
/bin/sh: yarn: command not found
at checkExecSyncError (child_process.js:616:11)
at Object.execSync (child_process.js:653:13)
at Dependencies.execute (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Dependencies.js:52:22)
at dependencies.reject.tap.dependencies (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Dependencies.js:30:22)
at Array.value (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/helpers.js:24:13)
at Dependencies.install (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Dependencies.js:29:14)
at Function.dependencies (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Assert.js:77:40)
at concat.filter.tap.dependencies (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/components/ComponentFactory.js:130:24)
at Array.value (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/helpers.js:24:13)
at ComponentFactory.installDependencies (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/components/ComponentFactory.js:129:14)
at Mix.listen (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/components/ComponentFactory.js:54:44)
at events.(anonymous function).forEach.handler (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Dispatcher.js:34:47)
at Array.forEach (<anonymous>)
at Dispatcher.fire (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Dispatcher.js:34:28)
at Mix.dispatch (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/src/Mix.js:119:25)
at Object.<anonymous> (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/laravel-mix/setup/webpack.config.js:19:5)
at Module._compile (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/v8-compile-cache/v8-compile-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 (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at WEBPACK_OPTIONS (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/convert-argv.js:133:13)
at requireConfig (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/convert-argv.js:135:6)
at /Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/convert-argv.js:142:17
at Array.forEach (<anonymous>)
at module.exports (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/convert-argv.js:140:15)
at yargs.parse (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/cli.js:241:39)
at Object.parse (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/yargs/yargs.js:567:18)
at /Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/cli.js:219:8
at Object.<anonymous> (/Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue/node_modules/webpack-cli/bin/cli.js:538: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)
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/webpack.config.js "--watch"`
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 logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kosingas/.npm/_logs/2018-12-31T13_48_22_168Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `npm run development -- --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/kosingas/.npm/_logs/2018-12-31T13_48_22_209Z-debug.log
Borivojes-MacBook-Pro:lvue kosingas$
我不确定该怎么办。一段时间以来一直在搜索报价,将Node从11降级到稳定的LTS版本10,什么都没有。
Click here to see the screenshot of the errors that I'm getting
这是我打开错误日志文件时看到的:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'watch' ]
2 info using npm@6.5.0
3 info using node@v10.15.0
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle @~prewatch: @
6 info lifecycle @~watch: @
7 verbose lifecycle @~watch: unsafe-perm in lifecycle true
8 verbose lifecycle @~watch: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Applications/MAMP_2018-03-15_05-39$
9 verbose lifecycle @~watch: CWD: /Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue
10 silly lifecycle @~watch: Args: [ '-c', 'npm run development -- --watch' ]
11 silly lifecycle @~watch: Returned: code: 1 signal: null
12 info lifecycle @~watch: Failed to exec watch script
13 verbose stack Error: @ watch: `npm run development -- --watch`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:962:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)
14 verbose pkgid @
15 verbose cwd /Applications/MAMP_2018-03-15_05-39-43/htdocs/sandbox/lvue
16 verbose Darwin 18.0.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "watch"
18 verbose node v10.15.0
答案 0 :(得分:1)
'vue-template-compiler
'在您的packag.json中丢失,请执行:
rm -R node_modules
npm install
npm install -g yarnpkg
npm install --save vue-template-compiler
npm run dev