How to automate the build from the following configuration using gulp

北战南征 提交于 2019-12-05 21:23:26

Taking into account your update

What might be happening is that once you change your directory using process.chdir for a sepearate task and also you have kept watch on all the tasks . The path is set to the previous path and the gulp task is not able to find the sdk i:e spawn('./node_modules/.bin/lb-sdk', ['server/server.js', './client/src/app/shared/sdk', '-q'], {stdio: 'inherit'}); in that respective path .

To fix this you can add the following check in the sdk task

gulp.task('sdk', function() {
  if (process.cwd() != __dirname) { // this checks for the current path 
    process.chdir(<change path>); // if it dosent match your base path change it here
  }
  spawn('./node_modules/.bin/lb-sdk', ['server/server.js', './client/src/app/shared/sdk', '-q'], {stdio: 'inherit'});
});
  1. Are you sure you've run npm install --save-dev @mean-expert/loopback-sdk-builder?
  2. Are you sure that gulpfile.js is in the same dir as package.json?
  3. Are you certain ./node_modules/.bin/lb-sdk exists?
  4. Have you tried reinstalling everything?

The answer to the error is simply that your spawn function can't find ./node_modules/.bin/lb-sdk. This is either because the file doesn't exist, or because the it can't be found relatively to your gulpfile.js

The ENOENT error in the console means "error: no entity". It comes from UNIX, rather than Node itself, and basically just translates to "file not found", but applies to a variety of generic things, not just files/directories.

Check that the file ./node_modules/.bin/lb-sdk definitely exists. Then check that your gulpfile is in the root relative to that directory.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!