'lite-server' 不是内部或外部命令,也不是可运行的程序或批处理文件
'lite-server' is not recognized as an internal or external command, operable program or batch file
我在 运行 Windows 10 上执行以下命令期间遇到此错误。
npm run dev
我是 运行 lite-server on windows 10,我尝试使用以下命令解决它
npm install -g npm-windows-upgrade
npm install -g concurrently
尽管我尝试删除 package.json 和节点模块,重新安装 nodejs。但它似乎不起作用。
CMD Err running npm run dev
日志文件如下
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.12.0
3 info using node@v12.13.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle AmrAhmed@1.0.0~predev: AmrAhmed@1.0.0
6 info lifecycle AmrAhmed@1.0.0~dev: AmrAhmed@1.0.0
7 verbose lifecycle AmrAhmed@1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle AmrAhmed@1.0.0~dev: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Amr\Desktop\Seecured-master\Seecured-master\election\node_modules\.bin;C:\Users\Amr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Amr\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Microsoft SQL Server0\Tools\Binn;C:\Program Files\MATLAB\R2014a\runtime\win64;C:\Program Files\MATLAB\R2014a\bin;C:\Program Files\MATLAB\R2014a\polyspace\bin;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\SRC\flutter\bin;C:\Users\Amr\AppData\Local\Programs\Python\Python36\Scripts;C:\Program Files\CMake\bin;C:\Program Files\nodejs;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Microsoft SQL Server0\Tools\Binn;C:\Program Files\MATLAB\R2014a\runtime\win64;C:\Program Files\MATLAB\R2014a\bin;C:\Program Files\MATLAB\R2014a\polyspace\bin;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\SRC\flutter\bin;C:\Users\Amr\AppData\Local\Programs\Python\Python36\Scripts;C:\Program Files\CMake\bin;C:\Python37\Scripts;C:\Users\Amr\AppData\Local\Programs\Microsoft VS Code\bin;C:\Python37\Scripts;C:\Users\Amr\AppData\Lo;C:\Program Files\nodejs;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle AmrAhmed@1.0.0~dev: CWD: C:\Users\Amr\Desktop\Seecured-master\Seecured-master\election
10 silly lifecycle AmrAhmed@1.0.0~dev: Args: [ '/d /s /c', 'lite-server' ]
11 silly lifecycle AmrAhmed@1.0.0~dev: Returned: code: 1 signal: null
12 info lifecycle AmrAhmed@1.0.0~dev: Failed to exec dev script
13 verbose stack Error: AmrAhmed@1.0.0 dev: `lite-server`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:210:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid AmrAhmed@1.0.0
15 verbose cwd C:\Users\Amr\Desktop\Seecured-master\Seecured-master\election
16 verbose Windows_NT 10.0.17763
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 v12.13.0
19 verbose npm v6.12.0
20 error code ELIFECYCLE
21 error errno 1
22 error AmrAhmed@1.0.0 dev: `lite-server`
22 error Exit status 1
23 error Failed at the AmrAhmed@1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
并且 package.json 文件具有以下脚本
{
"name": "AmrAhmed",
"version": "1.0.0",
"description": "",
"main": "truffle.js",
"directories": {
"test": "test"
},
"scripts": {
"dev": "lite-server",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"lite-server": "^2.3.0"
}
}
我已经安装了 node js 12.16.3 长期支持版本,看来问题已解决并且运行良好。
Running Npm run dev
你应该运行这个命令行
npm install lite-server@2.3 --save-dev
我在 运行 Windows 10 上执行以下命令期间遇到此错误。
npm run dev
我是 运行 lite-server on windows 10,我尝试使用以下命令解决它
npm install -g npm-windows-upgrade
npm install -g concurrently
尽管我尝试删除 package.json 和节点模块,重新安装 nodejs。但它似乎不起作用。
CMD Err running npm run dev 日志文件如下
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.12.0
3 info using node@v12.13.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle AmrAhmed@1.0.0~predev: AmrAhmed@1.0.0
6 info lifecycle AmrAhmed@1.0.0~dev: AmrAhmed@1.0.0
7 verbose lifecycle AmrAhmed@1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle AmrAhmed@1.0.0~dev: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Amr\Desktop\Seecured-master\Seecured-master\election\node_modules\.bin;C:\Users\Amr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Amr\bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Microsoft SQL Server0\Tools\Binn;C:\Program Files\MATLAB\R2014a\runtime\win64;C:\Program Files\MATLAB\R2014a\bin;C:\Program Files\MATLAB\R2014a\polyspace\bin;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\SRC\flutter\bin;C:\Users\Amr\AppData\Local\Programs\Python\Python36\Scripts;C:\Program Files\CMake\bin;C:\Program Files\nodejs;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Microsoft SQL Server0\Tools\Binn;C:\Program Files\MATLAB\R2014a\runtime\win64;C:\Program Files\MATLAB\R2014a\bin;C:\Program Files\MATLAB\R2014a\polyspace\bin;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\SRC\flutter\bin;C:\Users\Amr\AppData\Local\Programs\Python\Python36\Scripts;C:\Program Files\CMake\bin;C:\Python37\Scripts;C:\Users\Amr\AppData\Local\Programs\Microsoft VS Code\bin;C:\Python37\Scripts;C:\Users\Amr\AppData\Lo;C:\Program Files\nodejs;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle AmrAhmed@1.0.0~dev: CWD: C:\Users\Amr\Desktop\Seecured-master\Seecured-master\election
10 silly lifecycle AmrAhmed@1.0.0~dev: Args: [ '/d /s /c', 'lite-server' ]
11 silly lifecycle AmrAhmed@1.0.0~dev: Returned: code: 1 signal: null
12 info lifecycle AmrAhmed@1.0.0~dev: Failed to exec dev script
13 verbose stack Error: AmrAhmed@1.0.0 dev: `lite-server`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:210:5)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:210:5)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid AmrAhmed@1.0.0
15 verbose cwd C:\Users\Amr\Desktop\Seecured-master\Seecured-master\election
16 verbose Windows_NT 10.0.17763
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 v12.13.0
19 verbose npm v6.12.0
20 error code ELIFECYCLE
21 error errno 1
22 error AmrAhmed@1.0.0 dev: `lite-server`
22 error Exit status 1
23 error Failed at the AmrAhmed@1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
并且 package.json 文件具有以下脚本
{
"name": "AmrAhmed",
"version": "1.0.0",
"description": "",
"main": "truffle.js",
"directories": {
"test": "test"
},
"scripts": {
"dev": "lite-server",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"lite-server": "^2.3.0"
}
}
我已经安装了 node js 12.16.3 长期支持版本,看来问题已解决并且运行良好。
Running Npm run dev
你应该运行这个命令行
npm install lite-server@2.3 --save-dev