“npm run dev"命令不适用于带有 bash 错误的 Windows [英] 'npm run dev' command not working for windows with bash error

查看:78
本文介绍了“npm run dev"命令不适用于带有 bash 错误的 Windows的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个 Laravel nova 工具.我正在运行这个命令.

I'm trying to create a laravel nova tool. And I'm running this command.

npm run dev

但是我没有编译,而是收到了这个错误.

But instead of compiling I'm getting this error.

> @ 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>

如果有人知道如何解决这个问题,那将会很有帮助.

It would be great help if someone know how to fix this.

这是我的错误日志文件,

This is my error log file,

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 如上所述.现在收到此错误,

As instructed I downladed bash from this link and after unzipping copied bash.exe to C:\Users\Name\AppData\Roaming\npm as described. Now getting this error,

> @ 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

推荐答案

我在 Windows 10 上遇到了这个问题.试试吧$ npm run start

I had this problem on windows 10. Try instead $ npm run start

所有错误都由这个重新处理:

all errors are resloved by this:

$ npm install --save-dev babel-loader babel-core

$ npm install --save-dev babel-loader babel-core

.babelrc file { "presets": ["@babel/preset-env"] }

这篇关于“npm run dev"命令不适用于带有 bash 错误的 Windows的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆