npm start问题

问题:在执行命令npm start 是出现下列问题:

npm
[0]  WARN invalid config loglevel="notice"
[1] npm WARN invalid config loglevel="notice"
[0] 
[0] > angular-quickstart@1.0.0 build:watch /home/gjj/download/worksp/quickstart-master
[0] > tsc -p src/ -w
[0] 
[1] 
[1] > angular-quickstart@1.0.0 serve /home/gjj/download/worksp/quickstart-master
[1] > lite-server -c=bs-config.json
[1] 
[0] fs.js:1445
[0]     throw error;
[0]     ^
[0] 
[0] Error: watch src ENOSPC
[0]     at exports._errnoException (util.js:1020:11)
[0]     at FSWatcher.start (fs.js:1443:19)
[0]     at Object.fs.watch (fs.js:1470:11)
[0]     at Object.watchDirectory (/home/gjj/download/worksp/quickstart-master/node_modules/_typescript@2.1.6@typescript/lib/tsc.js:2268:32)
[0]     at Object.executeCommandLine (/home/gjj/download/worksp/quickstart-master/node_modules/_typescript@2.1.6@typescript/lib/tsc.js:52113:43)
[0]     at Object.<anonymous> (/home/gjj/download/worksp/quickstart-master/node_modules/_typescript@2.1.6@typescript/lib/tsc.js:52473:4)
[0]     at Module._compile (module.js:570:32)
[0]     at Object.Module._extensions..js (module.js:579:10)
[0]     at Module.load (module.js:487:32)
[0]     at tryModuleLoad (module.js:446:12)
[0] 
[0] npm ERR!
[0]  Linux 4.10.0-32-generic
[0] npm ERR! argv "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "run" "build:watch"
[0] npm ERR! node v6.11.2
[0] npm ERR! npm  v3.10.10
[0] npm ERR! code ELIFECYCLE
[0] npm ERR! angular-quickstart@1.0.0 build:watch: `tsc -p src/ -w`
[0] npm ERR! Exit status 1
[0] npm ERR! 
[0] npm ERR! Failed at the angular-quickstart@1.0.0 build:watch script 'tsc -p src/ -w'.
[0] npm ERR! Make sure you have the latest version of node.js and npm installed.
[0] npm ERR! If you do, this is most likely a problem with the angular-quickstart package,
[0] npm ERR! not with npm itself.
[0] npm ERR! Tell the author that this fails on your system:
[0] npm ERR!     tsc -p src/ -w
[0] npm ERR!
[0]  You can get information on how to open an issue for this project with:
[0] npm ERR!     npm bugs angular-quickstart
[0] npm ERR! Or if that isn't available, you can get their info via:
[0] npm ERR!     npm owner ls angular-quickstart
[0] npm ERR! There is likely additional logging output above.
[0] 
[0] npm ERR! Please include the following file with any support request:
[0] npm ERR!     /home/gjj/download/worksp/quickstart-master/npm-debug.log
[0] npm run build:watch exited with code 1
[1] ** browser-sync config **
[1] { injectChanges: false,
[1]   files: [ './**/*.{html,htm,css,js}' ],
[1]   watchOptions: { ignored: 'node_modules' },
[1]   server: 
[1]    { baseDir: 'src',
[1]      middleware: [ [Function], [Function] ],
[1]      routes: { '/node_modules': 'node_modules' } } }
[1] events.js:160
[1]       throw er; // Unhandled 'error' event
[1]       ^
[1] 
[1] Error: watch . ENOSPC
[1]     at exports._errnoException (util.js:1020:11)
[1]     at FSWatcher.start (fs.js:1443:19)
[1]     at Object.fs.watch (fs.js:1470:11)
[1]     at createFsWatchInstance (/home/gjj/download/worksp/quickstart-master/node_modules/_chokidar@1.7.0@chokidar/lib/nodefs-handler.js:37:15)
[1]     at setFsWatchListener (/home/gjj/download/worksp/quickstart-master/node_modules/_chokidar@1.7.0@chokidar/lib/nodefs-handler.js:80:15)
[1]     at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/gjj/download/worksp/quickstart-master/node_modules/_chokidar@1.7.0@chokidar/lib/nodefs-handler.js:228:14)
[1]     at FSWatcher.NodeFsHandler._handleDir (/home/gjj/download/worksp/quickstart-master/node_modules/_chokidar@1.7.0@chokidar/lib/nodefs-handler.js:407:19)
[1]     at FSWatcher.<anonymous> (/home/gjj/download/worksp/quickstart-master/node_modules/_chokidar@1.7.0@chokidar/lib/nodefs-handler.js:455:19)
[1]     at FSWatcher.<anonymous> (/home/gjj/download/worksp/quickstart-master/node_modules/_chokidar@1.7.0@chokidar/lib/nodefs-handler.js:460:16)
[1]     at FSReqWrap.oncomplete (fs.js:123:15)
[1] 
[1] npm ERR! Linux 4.10.0-32-generic
[1] npm ERR! argv "/usr/local/node/bin/node" "/usr/local/node/bin/npm" "run" "serve"
[1] npm ERR! node v6.11.2
[1] npm ERR! npm  v3.10.10
[1] npm 
[1] ERR! code ELIFECYCLE
[1] npm ERR! angular-quickstart@1.0.0 serve: `lite-server -c=bs-config.json`
[1] npm ERR! Exit status 1
[1] npm ERR! 
[1] npm ERR! Failed at the angular-quickstart@1.0.0 serve script 'lite-server -c=bs-config.json'.
[1] npm ERR! Make sure you have the latest version of node.js and npm installed.
[1] npm
[1]  ERR! If you do, this is most likely a problem with the angular-quickstart package,
[1] npm ERR! not with npm itself.
[1] npm ERR! Tell the author that this fails on your system:
[1] npm ERR!     lite-server -c=bs-config.json
[1] npm 
[1] ERR! You can get information on how to open an issue for this project with:
[1] npm ERR!     npm bugs angular-quickstart
[1] npm ERR! Or if that isn't available, you can get their info via:
[1] npm ERR!     npm owner ls angular-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/gjj/download/worksp/quickstart-master/npm-debug.log
[1] npm run serve exited with code 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! angular-quickstart@1.0.0 start: `concurrently "npm run build:watch" "npm run serve"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the angular-quickstart@1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-08-14T13_05_48_238Z-debug.log

解决办法:我执行命令的位置是/home/gjj/xxx,这是一个用户目录,出现上面的原因是空间不足。我怀疑是此目录空间的问题,你可以先将项目移至/usr/local/xxx下再次npm start,如果还不行,请参看一下方案,此方案来自https://stackoverflow.com/questions/22475849/node-js-error-enospc

执行如下命令:

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

对于Arch Linux,将下面这行添加到/etc/sysctl.d/99-sysctl.conf文件中

fs.inotify.max_user_watches=524288

vim /etc/sysctl.d/99-sysctl.conf
#添加到最后
fs.inotify.max_user_watches=524288

#完成后执行
sysctl --system

 

 

 

posted @ 2017-08-14 21:29  liter7  阅读(1144)  评论(0编辑  收藏  举报