我尝试安装应用程序脚本,但出现此错误。它搞砸了我的环境,我不能再使用ionic serve
了。
$ npm install @ionic/app-scripts --save-dev
ionic-hello-world@ /home/louisro/Documents/mobileApps/BoardLine/ionic2_version
├── @ionic/app-scripts@1.2.1
└── UNMET PEER DEPENDENCY typescript@2.0.9
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN @ionic/app-scripts@1.2.1 requires a peer of typescript@~2.2.1 but none was installed.
$ ionic info
Your system information:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.2.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.2.1
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Linux 4.4
Node Version: v7.4.0
Xcode version: Not installed
看起来您有一个UNMET PEER DEPENDENCY
尝试将打字稿固定到package.json中的兼容版本。
@ionic/app-scripts@1.2.1 需要 typescript@~2.2.1 的对等体,但没有安装任何对等体。
尝试在固定版本后执行以下命令,以确保重新安装node_modules
rm -rf node_modules && npm cache clean && npm install
npm install app-scripts@1.1.4 --save-dev
解决了。