You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

NativeScript安卓模拟器运行报错:TypeScript编译器退出码1求助

Fixing ENOSPC Error in NativeScript + TypeScript Projects on Linux

Hey there, let's get this sorted out! The critical error in your log is Error: watch /home/scideas/testApp2 ENOSPC — this isn't about running out of disk space, but rather your Linux system's default limit on how many files can be monitored by the inotify subsystem (which TypeScript uses for its watch mode). NativeScript + TypeScript projects have lots of files to track, and you've hit that ceiling.

Here's how to fix it:

1. Temporary Fix (Works Immediately, Resets on Reboot)

Run this command in your terminal to bump up the watch limit temporarily:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

This sets the maximum number of file watches to 524288, which is more than enough for most NativeScript projects.

2. Permanent Fix (Survives Reboots)

To make this change stick even after restarting your system:

  • Open the sysctl configuration file with a text editor:
    sudo nano /etc/sysctl.conf
    
  • Add this line at the end of the file:
    fs.inotify.max_user_watches=524288
    
  • Save and exit (in nano, press Ctrl+O, then Enter, then Ctrl+X).
  • Apply the changes immediately:
    sudo sysctl -p
    

3. Extra Checks

If the issue persists after adjusting the limit:

  • Verify how many watches are currently in use with:
    lsof | grep inotify | wc -l
    
    If this number is close to 524288, you might need to increase it further (though 524288 is sufficient for most cases).
  • Temporarily close any file managers, cloud sync tools, or other apps that might be using a lot of inotify watches — these can eat into your available quota.

Why your previous attempts didn't work

Upgrading TypeScript, NativeScript, Node.js, or deleting platforms/node_modules doesn't affect this system-level limit, which is why those steps didn't resolve the error. This is a common gotcha for Linux users working with watch-based development tools!


Your Project Configurations for Reference

package.json

{ "description": "NativeScript Application", "license": "SEE LICENSE IN <your-license-filename>", "readme": "NativeScript Application", "repository": "<fill-your-repository-here>", "nativescript": { "id": "org.nativescript.NgProject", "tns-android": { "version": "3.4.0" } }, "dependencies": { "@angular/animations": "~5.0.0", "@angular/common": "~5.0.0", "@angular/compiler": "~5.0.0", "@angular/core": "~5.0.0", "@angular/forms": "~5.0.0", "@angular/http": "~5.0.0", "@angular/platform-browser": "~5.0.0", "@angular/platform-browser-dynamic": "~5.0.0", "@angular/router": "~5.0.0", "allow-publish": "^1.0.4", "jssha": "^2.3.1", "nativescript-angular": "^5.0.0", "nativescript-sqlite": "^2.0.1", "nativescript-theme-core": "~1.0.4", "reflect-metadata": "~0.1.8", "rxjs": "~5.5.2", "tns-core-modules": "~3.4.0", "zone.js": "~0.8.2" }, "devDependencies": { "babel-traverse": "6.26.0", "babel-types": "6.26.0", "babylon": "6.18.0", "lazy": "1.0.11", "nativescript-dev-typescript": "~0.6.0", "typescript": "~2.4.2" } }

tsconfig.json

{ "compilerOptions": { "module": "commonjs", "target": "es5", "experimentalDecorators": true, "emitDecoratorMetadata": true, "noEmitHelpers": true, "noEmitOnError": true, "lib": [ "es6", "dom", "es2015.iterable" ], "baseUrl": ".", "paths": { "*": [ "./node_modules/tns-core-modules/*", "./node_modules/*" ] } }, "exclude": [ "node_modules", "platforms" ] }

内容的提问来源于stack exchange,提问作者Jigyasa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:47:14