Laravel,在新安装上运行npm run dev时出错



我刚刚创建了一个新的laravel 8项目,但我在运行npm install和npm run dev时遇到了问题,更具体地说,在运行npm-run dev的时候。我以前从未遇到过这个问题,也没有对我的NodeJ或类似的东西做过任何更改。我能够在没有任何错误的情况下编译我的依赖项,但今天我遇到了这个错误。

这是输出。

Admin@DESKTOP-KH5JMQG MINGW64 /c/Proyectos Web/Dashboarding
$ npm install
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules@typesbrowser-syncnode_moduleschokidarnode_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.1 (node_moduleschokidarnode_modulesfsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
added 1203 packages from 531 contributors and audited 1207 packages in 102.075s
94 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities

然后

$ npm run dev
> @ dev C:Proyectos WebDashboarding
> npm run development

> @ development C:Proyectos WebDashboarding
> mix
[webpack-cli] Running multiple commands at the same time is not possible
[webpack-cli] Found commands: 'bundle', 'WebDashboardingnode_moduleslaravel-mixsetupwebpack.config.js'
[webpack-cli] Run 'webpack --help' to see available commands and options
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ development: `mix`
npm ERR! Exit status 2
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!     C:UsersAdminAppDataRoamingnpm-cache_logs2021-01-09T03_45_41_921Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ dev 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!     C:UsersAdminAppDataRoamingnpm-cache_logs2021-01-09T03_45_41_975Z-debug.log

这是日志文件的内容:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\Program Files\nodejs\node.exe',
1 verbose cli   'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'dev'
1 verbose cli ]
2 info using npm@6.14.9
3 info using node@v14.15.3
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle @~predev: @
6 info lifecycle @~dev: @
7 verbose lifecycle @~dev: unsafe-perm in lifecycle true
8 verbose lifecycle @~dev: PATH: C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecyclenode-gyp-bin;C:Proyectos WebDashboardingnode_modules.bin;C:UsersAdminbin;C:Program FilesGitmingw64bin;C:Program FilesGitusrlocalbin;C:Program FilesGitusrbin;C:Program FilesGitusrbin;C:Program FilesGitmingw64bin;C:Program FilesGitusrbin;C:UsersAdminbin;C:WINDOWSsystem32;C:WINDOWS;C:WINDOWSSystem32Wbem;C:WINDOWSSystem32WindowsPowerShellv1.0;C:WINDOWSSystem32OpenSSH;C:Program Files (x86)IBMSPSSDataCollection6Accessories;C:Program Files (x86)Common FilesIBMSPSSDataCollection6DMOM;C:Program FilesAzure Data Studiobin;C:Program FilesMicrosoft SQL ServerClient SDKODBC170ToolsBinn;C:Program Files (x86)Microsoft SQL Server150ToolsBinn;C:Program FilesMicrosoft SQL Server150ToolsBinn;C:Program FilesMicrosoft SQL Server150DTSBinn;C:Program Files (x86)Microsoft SQL Server150DTSBinn;C:xamppphp;C:ProgramDataComposerSetupbin;C:Program Filesnodejs;C:Program Files (x86)Yarnbin;C:Program FilesGitcmd;C:UsersAdminanaconda3;C:UsersAdminanaconda3Librarymingw-w64bin;C:UsersAdminanaconda3Libraryusrbin;C:UsersAdminanaconda3Librarybin;C:UsersAdminanaconda3Scripts;C:UsersAdminAppDataLocalMicrosoftWindowsApps;C:Program Files (x86)Nmap;C:Program FilesAzure Data Studiobin;C:UsersAdminAppDataLocalProgramsMicrosoft VS Codebin;C:UsersAdminAppDataRoamingComposervendorbin;C:UsersAdminAppDataRoamingnpm;C:UsersAdminAppDataLocalYarnbin;C:Program FilesGitusrbinvendor_perl;C:Program FilesGitusrbincore_perl
9 verbose lifecycle @~dev: CWD: C:Proyectos WebDashboarding
10 silly lifecycle @~dev: Args: [ '/d /s /c', 'npm run development' ]
11 silly lifecycle @~dev: Returned: code: 2  signal: null
12 info lifecycle @~dev: Failed to exec dev script
13 verbose stack Error: @ dev: `npm run development`
13 verbose stack Exit status 2
13 verbose stack     at EventEmitter.<anonymous> (C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecycleindex.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:Program Filesnodejsnode_modulesnpmnode_modulesnpm-lifecyclelibspawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1048:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid @
15 verbose cwd C:Proyectos WebDashboarding
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "dev"
18 verbose node v14.15.3
19 verbose npm  v6.14.9
20 error code ELIFECYCLE
21 error errno 2
22 error @ dev: `npm run development`
22 error Exit status 2
23 error Failed at the @ dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 2, true ]

这是我的package.json文件

{
"private": true,
"scripts": {
"dev": "npm run development",
"development": "mix",
"watch": "mix watch",
"watch-poll": "mix watch -- --watch-options-poll=1000",
"hot": "mix watch --hot",
"prod": "npm run production",
"production": "mix --production"
},
"devDependencies": {
"@tailwindcss/forms": "^0.2.1",
"@tailwindcss/typography": "^0.3.0",
"alpinejs": "^2.7.3",
"autoprefixer": "^10.0.2",
"axios": "^0.21",
"laravel-mix": "^6.0.6",
"lodash": "^4.17.19",
"postcss": "^8.1.14",
"postcss-import": "^12.0.1",
"tailwindcss": "^2.0.1"
}
}

根据我对laravel 8安装错误-npm run dev throws错误的回答,您是一名Windows开发人员,项目路径名称中有空格。

尝试删除空格,看看它是否能解决您的问题。

最新更新