Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/joomla/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 角度2快速启动PC错误_Javascript_Node.js_Angular - Fatal编程技术网

Javascript 角度2快速启动PC错误

Javascript 角度2快速启动PC错误,javascript,node.js,angular,Javascript,Node.js,Angular,我正在试用关于angular 2的官方打字稿。我遵循了所有步骤,当我运行npm start时,它确实在我的firefox浏览器上弹出了我的第一个Angular 2应用程序的消息 但是,当我检查控制台时,我发现错误消息: Error: watch node_modules/angular2/es6/dev/src/common/directives/ng_if.js ENOSPC 我不知道这是否与我之前在项目根文件夹上运行npm install时收到的警告消息有关: npm WARN insta

我正在试用关于angular 2的官方打字稿。我遵循了所有步骤,当我运行
npm start
时,它确实在我的firefox浏览器上弹出了我的第一个Angular 2应用程序的
消息

但是,当我检查控制台时,我发现错误消息:

Error: watch node_modules/angular2/es6/dev/src/common/directives/ng_if.js ENOSPC
我不知道这是否与我之前在项目根文件夹上运行
npm install
时收到的警告消息有关:

npm WARN install Couldn't install optional dependency: Unsupported
npm WARN EPACKAGEJSON angular2-quickstart@1.0.0 No description
npm WARN EPACKAGEJSON angular2-quickstart@1.0.0 No repository field.
有人能告诉我我的方法出了什么问题吗?更详细的控制台输出如下所示:

> angular2-quickstart@1.0.0 start /home/ubuntu/jsProjects/angular2-quickstart
> concurrent "npm run tsc:w" "npm run lite" 

[0] 
[0] > angular2-quickstart@1.0.0 tsc:w /home/ubuntu/jsProjects/angular2-quickstart
[0] > tsc -w
[0] 
[1] 
[1] > angular2-quickstart@1.0.0 lite /home/ubuntu/jsProjects/angular2-quickstart
[1] > lite-server
[1] 
[1] [BS] Access URLs:
[1]  ----------------------------------
[1]        Local: http://localhost:3000
[1]     External: http://10.0.0.17:3000
[1]  ----------------------------------
[1]           UI: http://localhost:3001
[1]  UI External: http://10.0.0.17:3001
[1]  ----------------------------------
[1] [BS] Serving files from: ./
[1] [BS] Watching files...
[1] 15.12.19 08:14:48 304 GET /./index.html (Unknown - 59ms)
[1] 15.12.19 08:14:49 304 GET /node_modules/es6-shim/es6-shim.js (Unknown - 729ms)
[1] 15.12.19 08:14:49 304 GET /node_modules/angular2/bundles/angular2-polyfills.js (Unknown - 205ms)
[1] 15.12.19 08:14:49 304 GET /node_modules/systemjs/dist/system.src.js (Unknown - 204ms)
[1] 15.12.19 08:14:49 304 GET /node_modules/rxjs/bundles/Rx.js (Unknown - 204ms)
[1] 15.12.19 08:14:49 304 GET /node_modules/angular2/bundles/angular2.dev.js (Unknown - 204ms)
[0] 8:14:50 AM - Compilation complete. Watching for file changes.
[1] [BS] File changed: app/app.component.js
[1] [BS] File changed: app/boot.js
[1] 15.12.19 08:14:51 200 GET /app/boot.js (Unknown - 92ms)
[1] 15.12.19 08:14:52 200 GET /app/app.component.js (Unknown - 29ms)
[1] events.js:141
[1]       throw er; // Unhandled 'error' event
[1]       ^
[1] 
[1] Error: watch node_modules/angular2/es6/dev/src/common/directives/ng_if.js ENOSPC
[1]     at exports._errnoException (util.js:855:11)
[1]     at FSWatcher.start (fs.js:1313:19)
[1]     at Object.fs.watch (fs.js:1341:11)
[1]     at createFsWatchInstance (/home/ubuntu/jsProjects/angular2-quickstart/node_modules/chokidar/lib/nodefs-handler.js:37:15)
[1]     at setFsWatchListener (/home/ubuntu/jsProjects/angular2-quickstart/node_modules/chokidar/lib/nodefs-handler.js:80:15)
[1]     at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/ubuntu/jsProjects/angular2-quickstart/node_modules/chokidar/lib/nodefs-handler.js:228:14)
[1]     at FSWatcher.NodeFsHandler._handleFile (/home/ubuntu/jsProjects/angular2-quickstart/node_modules/chokidar/lib/nodefs-handler.js:255:21)
[1]     at FSWatcher.<anonymous> (/home/ubuntu/jsProjects/angular2-quickstart/node_modules/chokidar/lib/nodefs-handler.js:473:21)
[1]     at FSReqWrap.oncomplete (fs.js:82:15)
[1] 
[1] npm ERR! Linux 3.19.0-41-generic
[1] npm 
[1] ERR! argv "/opt/node-v5.3.0-linux-x64/bin/node" "/opt/node-v5.3.0-linux-x64/bin/npm" "run" "lite"
[1] npm ERR! node v5.3.0
[1] npm ERR! npm  v3.3.12
[1] npm ERR! code ELIFECYCLE
[1] npm ERR! angular2-quickstart@1.0.0 lite: `lite-server`
[1] npm ERR! Exit status 1
[1] npm ERR! 
[1] npm ERR! Failed at the angular2-quickstart@1.0.0 lite script 'lite-server'.
[1] npm ERR! Make sure you have the latest version of node.js and npm installed.
[1] npm ERR! If you do, this is most likely a problem with the angular2-quickstart package,
[1] npm ERR! not with npm itself.
[1] npm ERR!
[1]  Tell the author that this fails on your system:
[1] npm ERR!     lite-server
[1] npm ERR! You can get their info via:
[1] npm ERR!     npm owner ls angular2-quickstart
[1] npm ERR! There is likely additional logging output above.
[1] 
[1] npm ERR! Please include the following file with any support request:
[1] npm ERR!     /home/ubuntu/jsProjects/angular2-quickstart/npm-debug.log
[1] npm run lite exited with code 1
角度2-quickstart@1.0.0start/home/ubuntu/jsProjects/angular2快速启动 >并发“npm运行tsc:w”“npm运行lite” [0] [0]>角度2-quickstart@1.0.0tsc:w/home/ubuntu/jsProjects/angular2快速启动 [0]>tsc-w [0] [1] [1] >角度2-quickstart@1.0.0lite/home/ubuntu/jsProjects/angular2快速启动 [1] >lite服务器 [1] [1] [BS]访问URL: [1] ---------------------------------- [1] 本地:http://localhost:3000 [1] 外部:http://10.0.0.17:3000 [1] ---------------------------------- [1] 用户界面:http://localhost:3001 [1] 用户界面外部:http://10.0.0.17:3001 [1] ---------------------------------- [1] [BS]从以下位置提供文件服务:/ [1] [BS]正在查看文件。。。 [1] 15.12.19 08:14:48 304 GET//index.html(未知-59ms) [1] 15.12.19 08:14:49 304 GET/node_modules/es6 shim/es6-shim.js(未知-729ms) [1] 15.12.19 08:14:49 304 GET/node_modules/angular2/bundles/angular2-polyfills.js(未知-205ms) [1] 15.12.19 08:14:49 304 GET/node_modules/systemjs/dist/system.src.js(未知-204ms) [1] 15.12.19 08:14:49 304 GET/node_modules/rxjs/bundles/Rx.js(未知-204ms) [1] 15.12.19 08:14:49 304 GET/node_modules/angular2/bundles/angular2.dev.js(未知-204ms) [0]上午8:14:50-编译完成。监视文件更改。 [1] [BS]文件已更改:app/app.component.js [1] [BS]文件已更改:app/boot.js [1] 15.12.19 08:14:51 200 GET/app/boot.js(未知-92ms) [1] 15.12.19 08:14:52 200 GET/app/app.component.js(未知-29毫秒) [1] events.js:141 [1] 投掷者;//未处理的“错误”事件 [1] ^ [1] [1] 错误:监视node_modules/angular2/es6/dev/src/common/directives/ng_if.js/pc [1] 导出时出现异常(util.js:855:11) [1] 在FSWatcher.start(fs.js:1313:19) [1] 在Object.fs.watch(fs.js:1341:11) [1] 在createFsWatchInstance(/home/ubuntu/jsProjects/angular2 quickstart/node_modules/chokidar/lib/nodefs handler.js:37:15) [1] 在setFsWatchListener(/home/ubuntu/jsProjects/angular2 quickstart/node_modules/chokidar/lib/nodefs handler.js:80:15) [1] 在FSWatcher.NodeFsHandler._watchWithNodeFs(/home/ubuntu/jsProjects/angular2 quickstart/node_modules/chokidar/lib/nodefs handler.js:228:14) [1] 在FSWatcher.NodeFsHandler._handleFile(/home/ubuntu/jsProjects/angular2 quickstart/node_modules/chokidar/lib/nodefs handler.js:255:21) [1] 在FSWatcher。(/home/ubuntu/jsProjects/angular2 quickstart/node_modules/chokidar/lib/nodefs handler.js:473:21) [1] 在FSReqWrap.oncomplete(fs.js:82:15) [1] [1] npm错误!Linux 3.19.0-41-generic [1] npm [1] 呃!argv“/opt/node-v5.3.0-linux-x64/bin/node”“/opt/node-v5.3.0-linux-x64/bin/npm”“运行”“精简” [1] npm错误!节点v5.3.0 [1] npm错误!npm v3.3.12 [1] npm错误!代码失效循环 [1] npm错误!角2-quickstart@1.0.0lite:`lite服务器` [1] npm错误!退出状态1 [1] npm错误! [1] npm错误!在角度2处失败-quickstart@1.0.0lite脚本“lite服务器”。 [1] npm错误!确保已安装最新版本的node.js和npm。 [1] npm错误!如果您这样做,这很可能是angular2 quickstart软件包的问题, [1] npm错误!与npm本身无关。 [1] npm错误! [1] 告诉作者此操作在您的系统上失败: [1] npm错误!lite服务器 [1] npm错误!您可以通过以下方式获取他们的信息: [1] npm错误!npm所有者ls angular2快速启动 [1] npm错误!上面可能还有其他日志输出。 [1] [1] npm错误!请在任何支持请求中包括以下文件: [1] npm错误/home/ubuntu/jsProjects/angular2 quickstart/npm-debug.log [1] npm运行lite已退出,代码为1
我通过增加inotify观察者的数量来解决这个问题:

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

此错误也可能在其他过程中发生(例如,更现代的
ng-serve


虽然如果您不信任代码,应该避免此错误,但使用
sudo
运行命令将很快修复此错误。

磁盘是否已满?用户是否有正确的权限在需要写入的地方写入?@m90不,它还没有满,我有权限在项目文件夹中写入。也许这对您有帮助:此外,这与:这肯定解决了angular 2教程()上运行
npm start
时出现的
eNOPC
问题,谢谢你的分享!为什么有这么多依赖关系?对于一个简单的“hello world”项目,node_modules文件夹中有374个目录,这似乎有点过分了。将sudo授予这样一个有风险的命令是不明智的,因为可以通过npm依赖项运行的源代码来源几乎是无限多样的。