问题描述
我遇到了一些计算机问题,当我尝试 ng serve
我的 ionic 2 应用程序时收到以下错误:
I had some computer issue, and when I tried to ng serve
my ionic 2 app I received this error:
c:xampphtdocshemill>离子服务
ionic-hello-world@ ionic:serve c:xampphtdocshemillionic-app-scripts 服务于--v2"--address"0.0.0.0"--port"8100"--livereload-port"35729"
'ionic-app-scripts' 未被识别为内部或外部命令、可运行的程序或批处理文件.
'ionic-app-scripts' is not recognized as an internal or external command, operable program or batch file.
npm 错误!Windows_NT 10.0.14393 npm 错误!argv "C:程序文件odejsode.exe""C:UsershomeAppDataRoamingpmode_modulespminpm-cli.js"运行"离子:服务"--"--v2"--address"0.0.0.0"--port"8100"--livereload-port" 35729" npm 错误!节点 v6.9.2 npm 错误!npm v4.0.2npm 错误!代码 ELIFECYCLE npm 错误!离子你好世界@离子:服务:ionic-app-scripts 服务于 "--v2" "--address" "0.0.0.0" "--port" "8100""--livereload-port" "35729"
npm 错误!退出状态 1 npm ERR!npm 错误!在 ionic-hello-world@ ionic:serve 脚本 'ionic-app-scripts 失败服务 --v2" --address" 0.0.0.0" --port" 8100" --livereload-port"35729".npm 错误!确保您拥有最新版本的 node.js并安装了 npm.npm 错误!如果你这样做,这很可能是一个问题使用 ionic-hello-world 包,npm ERR!不是 npm 本身.npm呃!告诉作者这在您的系统上失败:npm ERR!
ionic-app-scripts 服务于--v2"--address"0.0.0.0"--port"8100""--livereload-port" "35729"
npm ERR! Windows_NT 10.0.14393 npm ERR! argv "C:Program Filesodejsode.exe" "C:UsershomeAppDataRoamingpmode_modulespminpm-cli.js" "run" "ionic:serve" "--" "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729" npm ERR! node v6.9.2 npm ERR! npm v4.0.2 npm ERR! code ELIFECYCLE npm ERR! ionic-hello-world@ ionic:serve: ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the ionic-hello-world@ ionic:serve script 'ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the ionic-hello-world package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR!
ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
我尝试在全局范围内卸载、安装、安装,但没有解决.有什么想法吗?
I tried to unistall, install, install globally, but it didn't solve.Any ideas what's wrong?
Windows 10.
Windows 10.
推荐答案
就我而言,问题是我在 Mac 上工作并试图将项目转移到 Windows 10 机器上.后续步骤:
In my case the problem was that I was working on a mac and attempted to transfer the project to a windows 10 machine. Steps to follow:
- 在您的终端中,导航到 ionic 项目的根文件夹
- 运行这个命令:
npm install @ionic/app-scripts@latest --save-dev
- 运行
npm rebuild node-sass
为当前环境构建绑定.
- In your terminal, navigate to the ionic project's root folder
- Run this command:
npm install @ionic/app-scripts@latest --save-dev
- Run
npm rebuild node-sass
to build the binding for your current environment.
我不知道你的情况是什么,但就我而言,上述步骤有效.
I don't know what your case is but in my case, the above steps worked.
如果您的情况不同,也许这里的文档:
If your case is different, perhaps the documentaion here:
https://www.npmjs.com/package/@ionic/app-脚本
将帮助您入门.
这篇关于'ionic-app-scripts' 未被识别为内部或外部命令,的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!