我在运行命令时遇到问题: npm run serve
修复它我需要注销或重启我的Ubuntu 16.04
我已检查正在运行的任务,节点未运行。
我还卸载了node和npm并再次安装了NVM,但我仍然遇到了问题。
Npm错误日志:
> customer-frontend@0.1.0 serve /home/work/work/git_repositories/xyz/ customer-frontend
> vue-cli-service serve --open
INFO Starting development server...
Starting type checking service...
Using 1 worker with 2048MB memory limit
10% building modules 1/1 modules 0 activeevents.js:183
throw er; // Unhandled 'error' event
^
Error: watch /home/work/work/git_repositories/xyz/customer-frontend/public ENOSPC
at _errnoException (util.js:1022:11)
at FSWatcher.start (fs.js:1374:19)
at Object.fs.watch (fs.js:1400:11)
at createFsWatchInstance (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.<anonymous> (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (/home/work/work/git_repositories/xyz/customer-frontend/node_modules/webpack-dev-server/node_modules/chokidar/lib/nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:153:5)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! customer-frontend@0.1.0 serve: `vue-cli-service serve --open`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the s customer-frontend@0.1.0 serve 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! /home/work/.npm/_logs/2018-02-27T11_40_39_880Z-debug.log
/home/work/.npm/_logs/2018-02-27T11_40_39_880Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/home/work/.nvm/versions/node/v8.9.4/bin/node',
1 verbose cli '/home/work/.nvm/versions/node/v8.9.4/bin/npm',
1 verbose cli 'run',
1 verbose cli 'serve' ]
2 info using npm@5.6.0
3 info using node@v8.9.4
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle customer-frontend@0.1.0~preserve: customer-frontend@0.1.0
6 info lifecycle customer-frontend@0.1.0~serve: customer-frontend@0.1.0
7 verbose lifecycle customer-frontend@0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle customer-frontend@0.1.0~serve: PATH: /home/work/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/work/work/git_repositories/XYZ/customer-frontend/node_modules/.bin:/home/work/.nvm/versions/node/v8.9.4/bin:/home/work/bin:/home/work/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/jvm/java-8-oracle/bin:/usr/lib/jvm/java-8-oracle/db/bin:/usr/lib/jvm/java-8-oracle/jre/bin
9 verbose lifecycle customer-frontend@0.1.0~serve: CWD: /home/work/work/git_repositories/XYZ/customer-frontend
10 silly lifecycle customer-frontend@0.1.0~serve: Args: [ '-c', 'vue-cli-service serve --open' ]
11 silly lifecycle customer-frontend@0.1.0~serve: Returned: code: 1 signal: null
12 info lifecycle customer-frontend@0.1.0~serve: Failed to exec serve script
13 verbose stack Error: customer-frontend@0.1.0 serve: `vue-cli-service serve --open`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/work/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/home/work/.nvm/versions/node/v8.9.4/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid customer-frontend@0.1.0
15 verbose cwd /home/work/work/git_repositories/XYZ/customer-frontend
16 verbose Linux 4.13.0-36-generic
17 verbose argv "/home/work/.nvm/versions/node/v8.9.4/bin/node" "/home/work/.nvm/versions/node/v8.9.4/bin/npm" "run" "serve"
18 verbose node v8.9.4
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error customer-frontend@0.1.0 serve: `vue-cli-service serve --open`
22 error Exit status 1
23 error Failed at the customer-frontend@0.1.0 serve script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
该项目基于 Vuejs(打字稿)
问题是我可以在其他正常Vuejs(不是打字稿)的项目上运行“npm run dev”而没有问题
这是 Package.json
{
"name": "xyz-customer-frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve --open",
"build": "vue-cli-service build",
"test": "vue-cli-service test",
"e2e": "vue-cli-service e2e",
"e2e:open": "vue-cli-service e2e:open"
},
"dependencies": {
"axios": "^0.17.1",
"buefy": "^0.6.3",
"bulma": "^0.6.2",
"echarts": "^4.0.2",
"register-service-worker": "^1.0.0",
"vue": "^2.5.13",
"vue-class-component": "^6.0.0",
"vue-property-decorator": "^6.0.0",
"vue-router": "^3.0.1",
"vuex": "^3.0.1",
"vuex-class": "^0.3.0",
"vuex-persistedstate": "^2.4.2"
},
"devDependencies": {
"@types/chai": "^4.1.0",
"@types/mocha": "^2.2.46",
"@vue/cli-plugin-babel": "^3.0.0-beta.1",
"@vue/cli-plugin-e2e-cypress": "^3.0.0-beta.1",
"@vue/cli-plugin-pwa": "^3.0.0-beta.1",
"@vue/cli-plugin-typescript": "^3.0.0-beta.1",
"@vue/cli-plugin-unit-mocha": "^3.0.0-beta.1",
"@vue/cli-service": "^3.0.0-beta.1",
"@vue/test-utils": "^1.0.0-beta.10",
"chai": "^4.1.2",
"node-sass": "^4.7.2",
"sass-loader": "^6.0.6",
"vue-template-compiler": "^2.5.13"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
}
节点版本:v8.9.4
Npm版本:v5.6.0
感谢您的时间。
答案 0 :(得分:7)
运行此代码解决了我在ubuntu 16.04上的问题
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
答案 1 :(得分:4)
老实说,我不知道为什么会发生此错误!
但是,一旦我在终端中使用sudo
测试了它,它就会起作用:
sudo npm run serve
或者,为了发展:
sudo npm run dev