背景
因为有一些前端依赖的库是私服的,只有在局域网中才能下载到。所以我直接把node_modules
复制过来直接使用的。我是从windows系统中复制到macOS中使用。
现象
bash
npm run serve
> fronted@0.1.0 serve /Users/itkey/workspace/frontend
> vue-cli-service serve
sh: /Users/itkey/workspace/node_modules/.bin/vue-cli-service: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! fronted@0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the fronted@0.1.0 serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
解决办法
通过上面可以看出来,应该是没有可执行权限导致的。
bash
chmod +x /Users/itkey/workspace/frontend/node_modules/.bin/vue-cli-service
问题得到解决。