我使用npm install -g ionic@4.1.0
我与ionic start ionic-4-project blank --type=angular
我尝试使用ionic serve
这是控制台中的错误消息。
> ng run app:serve --host=0.0.0.0 --port=8100
[ng] Could not find API compiler-cli, function VERSION
[ng] Error: Could not find API compiler-cli, function VE
RSION
[ng] at _error (C:\Users\Me\AppData\Roaming\npm\node
_modules\@angular-devkit\build-angular\node_modules\@ngt
ools\webpack\src\ngtools_api.js:8:11)
[ng] at getApiMember (C:\Users\Me\AppData\Roaming\np
m\node_modules\@angular-devkit\build-angular\node_module
s\@ngtools\webpack\src\ngtools_api.js:11:32)
[ng] at Object.<anonymous> (C:\Users\Me\AppData\Roam
ing\npm\node_modules\@angular-devkit\build-angular\node_
modules\@ngtools\webpack\src\ngtools_api.js:50:19)
[ng] at Module._compile (module.js:652:30)
[ng] at Object.Module._extensions..js (module.js:663
:10)
[ng] at Module.load (module.js:565:32)
[ng] at tryModuleLoad (module.js:505:12)
[ng] at Function.Module._load (module.js:497:3)
[ng] at Module.require (module.js:596:17)
[ng] at require (internal/module.js:11:18)
[ng] at Object.<anonymous> (C:\Users\Me\AppData\Roam
ing\npm\node_modules\@angular-devkit\build-angular\node_
modules\@ngtools\webpack\src\angular_compiler_plugin.js:
28:23)
[ng] at Module._compile (module.js:652:30)
[ng] at Object.Module._extensions..js (module.js:663
:10)
[ng] at Module.load (module.js:565:32)
[ng] at tryModuleLoad (module.js:505:12)
[ng] at Function.Module._load (module.js:497:3)
[ERROR] A utility CLI has unexpectedly closed (exit code
1).
The Ionic CLI will exit. Please check any output
above for error
details.
net.js:704
throw new TypeError(
^
TypeError: Invalid data, chunk must be a string or buffer, not object
at WriteStream.Socket.write (net.js:704:11)
at process.<anonymous> (C:\Users\Me\AppData\Roaming\npm\node_modules\ionic\bin\ionic:9:63)
at emitTwo (events.js:126:13)
at process.emit (events.js:214:7)
at emitPendingUnhandledRejections (internal/process/promises.js:108:22)
at process._tickCallback (internal/process/next_tick.js:189:7)
PS C:\Users\Me\Desktop\WebApps\fo\ionic-4-pd>
请让我知道您可能还需要其他什么信息。谢谢。
我在寡妇上10 节点版本:8.11.3 Npm版本:6.4.0
答案 0 :(得分:1)
删除node_modules。然后使用“ npm cache clean --verify”清除npm cache。然后执行npm install。
答案 1 :(得分:-1)
npm config set -g production false
然后我开始了一个新项目,一切正常。