我正在尝试创建一个laravel nova工具。我正在运行此命令。
npm run dev
但是我没有编译,而是遇到了这个错误。
> @ dev C:\wamp64\www\project
> npm run development
npm ERR! file bash
npm ERR! path bash
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn bash
npm ERR! @ dev: `npm run development`
npm ERR! spawn bash ENOENT
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:\Users\Name\AppData\Roaming\npm-cache\_logs\2019-04-03T13_41_19_035Z-debug.log
C:\wamp64\www\project>
这是我的错误日志文件,
0 info it worked if it ends with ok
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' ]
2 info using npm@6.4.1
3 info using node@v10.15.0
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 Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\wamp64\www\project\node_modules\.bin;C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\PuTTY\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\xampp\php;C:\xampp\mysql\bin;C:\xampp\perl\bin;C:\ProgramData\ComposerSetup\bin;C:\Program Files (x86)\Plantronics\Spokes3G\;C:\wamp64\bin\php\php7.2.10;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\nodejs\;C:\Program Files (x86)\Yarn\bin;C:\Users\Name\AppData\Local\Microsoft\WindowsApps;C:\Users\Name\AppData\Roaming\Composer\vendor\bin;C:\Users\Name\AppData\Roaming\npm;C:\Users\Name\AppData\Local\Yarn\bin;
9 verbose lifecycle @~dev: CWD: C:\wamp64\www\project
10 silly lifecycle @~dev: Args: [ '-c', 'npm run development' ]
11 info lifecycle @~dev: Failed to exec dev script
12 silly lifecycle @~dev: Returned: code: -4058 signal: null
13 info lifecycle @~dev: Failed to exec dev script
14 verbose stack Error: @ dev: `npm run development`
14 verbose stack spawn bash ENOENT
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:232:19)
14 verbose stack at onErrorNT (internal/child_process.js:407:16)
14 verbose stack at process._tickCallback (internal/process/next_tick.js:63:19)
15 verbose pkgid @
16 verbose cwd C:\wamp64\www\project
17 verbose Windows_NT 10.0.17134
18 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
19 verbose node v10.15.0
20 verbose npm v6.4.1
21 error file bash
22 error path bash
23 error code ELIFECYCLE
24 error errno ENOENT
25 error syscall spawn bash
26 error @ dev: `npm run development`
26 error spawn bash ENOENT
27 error Failed at the @ dev script.
27 error This is probably not a problem with npm. There is likely additional logging output above.
28 verbose exit [ 1, true ]
按照指示,我从此link下载了bash,并按说明将复制的bash.exe解压缩到 C:\ Users \ Name \ AppData \ Roaming \ npm 。现在出现此错误,
> @ dev C:\wamp64\www\project
> npm run development
bash: sh: No such file or directory
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 126
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:\Users\Name\AppData\Roaming\npm-cache\_logs\2019-04-03T14_36_05_198Z-debug.log
答案 0 :(得分:1)
您的系统不知道bash
。
这是因为未安装或不在%PATH%
中,或者%PATH
对npm(环境)不可用。当您访问具有全局性但实际上仅在特定项目路径中可用的脚本时,也会发生这种情况。
首先请确保已安装适当的二进制文件,然后尝试使用绝对路径。
很可能是因为您在 Windows 上,所以没有安装bash
或npm不知道它在哪里。
答案 1 :(得分:1)
我在Windows 10上遇到了这个问题。 $ npm运行开始
所有错误都由此得到解决:
$ npm install --save-dev babel-loader babel-core
.babelrc file { "presets": ["@babel/preset-env"] }