无法在新电脑上使用 ionic - 无法为空白项目提供服务
Unable to use ionic on new pc - cannot serve a blank project
我电脑上的磁盘最近损坏了。我不得不把它换掉。替换后我在重新安装 ionic 时遇到了一些严重的问题。
重新安装后 node.js - 13.7.0
然后在 运行ning
之后在 cmd 中
npm install -g ionic
我收到以下警告,但似乎安装正常。
npm WARN deprecated superagent@4.1.0: Please note that v5.0.1+ of superagent removes User-Agent
header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a
User-
Agent header). This notice will go away with v5.0.2+ once it is released.
C:\Users\stephen\ionic -> C:\Users\stephen\node_modules\ionic\bin\ionic
+ ionic@5.4.15
added 247 packages from 154 contributors in 18.455s
我检查了版本
ionic version
返回 5.4.15 所以安装正常
但是运行宁
之后
ionic start
和运行一个空白项目我得到以下错误。
npm WARN karma-jasmine-html-reporter@1.5.1 requires a peer of jasmine-core@>=3.5 but none is
installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\webpack-
dev-server\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY:
Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11
(node_modules\watchpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11:
wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11
(node_modules\karma\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11:
wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11
(node_modules\@angular\compiler-cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11:
wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2:
wanted
{ "os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code EEXIST
npm ERR! path C:\Users\stephen\test3\node_modules\browserslist\cli.js
npm ERR! dest C:\Users\stephen\test3\browserslist
npm ERR! EEXIST: file already exists, cmd shim
'C:\Users\stephen\test3\node_modules\browserslist\cli.js'
->
'C:\Users\stephen\test3\browserslist'
npm ERR! File exists: C:\Users\stephen\test3\browserslist
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\stephen\AppData\Roaming\npm-cache\_logs20-01-31T11_10_22_715Z-
debug.log
[ERROR] An error occurred while running subprocess npm.
它确实创建了空白项目,但我尝试为它提供服务时出现以下错误:
ionic : The term 'ionic' is not recognized as the name of a cmdlet, function, script file, or
operable program.
Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
+ ionic serve
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (ionic:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我看到他们已经更新到 ionic 5,我猜这是问题所在。如何安装 ionic 4???
您应该按照官方指南 here 并使用 npm install -g @ionic/cli
安装,而不仅仅是 npm install -g ionic
出现问题是因为我在桌面上保存了离子文件,离子安装前。
我卸载了ionic,node.js。将所有文件移动到外部硬盘驱动器并关闭我的电脑。
重新启动我的电脑,重新安装 node.js 和 ionic。
我电脑上的磁盘最近损坏了。我不得不把它换掉。替换后我在重新安装 ionic 时遇到了一些严重的问题。
重新安装后 node.js - 13.7.0
然后在 运行ning
之后在 cmd 中 npm install -g ionic
我收到以下警告,但似乎安装正常。
npm WARN deprecated superagent@4.1.0: Please note that v5.0.1+ of superagent removes User-Agent
header by default, therefore you may need to add it yourself (e.g. GitHub blocks requests without a
User-
Agent header). This notice will go away with v5.0.2+ once it is released.
C:\Users\stephen\ionic -> C:\Users\stephen\node_modules\ionic\bin\ionic
+ ionic@5.4.15
added 247 packages from 154 contributors in 18.455s
我检查了版本
ionic version
返回 5.4.15 所以安装正常
但是运行宁
之后 ionic start
和运行一个空白项目我得到以下错误。
npm WARN karma-jasmine-html-reporter@1.5.1 requires a peer of jasmine-core@>=3.5 but none is
installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\webpack-
dev-server\node_modules\fsevents):npm WARN notsup SKIPPING OPTIONAL DEPENDENCY:
Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11
(node_modules\watchpack\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11:
wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11
(node_modules\karma\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11:
wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11
(node_modules\@angular\compiler-cli\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11:
wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2:
wanted
{ "os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code EEXIST
npm ERR! path C:\Users\stephen\test3\node_modules\browserslist\cli.js
npm ERR! dest C:\Users\stephen\test3\browserslist
npm ERR! EEXIST: file already exists, cmd shim
'C:\Users\stephen\test3\node_modules\browserslist\cli.js'
->
'C:\Users\stephen\test3\browserslist'
npm ERR! File exists: C:\Users\stephen\test3\browserslist
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\stephen\AppData\Roaming\npm-cache\_logs20-01-31T11_10_22_715Z-
debug.log
[ERROR] An error occurred while running subprocess npm.
它确实创建了空白项目,但我尝试为它提供服务时出现以下错误:
ionic : The term 'ionic' is not recognized as the name of a cmdlet, function, script file, or
operable program.
Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
At line:1 char:1
+ ionic serve
+ ~~~~~
+ CategoryInfo : ObjectNotFound: (ionic:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我看到他们已经更新到 ionic 5,我猜这是问题所在。如何安装 ionic 4???
您应该按照官方指南 here 并使用 npm install -g @ionic/cli
安装,而不仅仅是 npm install -g ionic
出现问题是因为我在桌面上保存了离子文件,离子安装前。
我卸载了ionic,node.js。将所有文件移动到外部硬盘驱动器并关闭我的电脑。
重新启动我的电脑,重新安装 node.js 和 ionic。