2

我升级了离子使用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

4

2 回答 2

2

删除节点模块。然后使用“npm cache clean --verify”清除 npm 缓存。然后执行 npm 安装。

于 2018-08-22T08:46:40.070 回答
-1

npm config set -g production false

然后我开始了一个新项目,一切正常。

于 2018-08-23T06:46:44.537 回答