The gulp task
/* Run the npm script npm run buildLsdk using gulp */
gulp.task('sdk', function() {
if (process.cwd() != basePath) {
process.chdir('..');
// console.log(process.cwd());
}
spawn('./node_modules/.bin/lb-sdk', ['server/server.js', './client/src/app/shared/sdk', '-q'], {stdio: 'inherit'});
});
I am getting the following stack trace but i cannot debug
Error: spawn ./node_modules/.bin/lb-sdk ENOENT
at exports._errnoException (util.js:1022:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:607:11)
at run (bootstrap_node.js:420:7)
at startup (bootstrap_node.js:139:9)
at bootstrap_node.js:535:3
I have all the necessary files in node modules too any help is really appreciated.
More reference on the File use above - https://github.com/rahulrsingh09/loopback-Angular-Starter/blob/master/gulpfile.js
I think it's because lb-sdk.cmd is the file you're supposed to run on windows. when I changed the command to the below the error goes away. Please note the windows style directory slashes are different from linux.
gulp.task('sdk', function() {
spawn(
'.\\node_modules\\.bin\\lb-sdk.cmd',
[
'.\\server\\server.js',
'.\\client\\src\\app\\shared\\sdk',
'-q'
], {stdio: 'inherit'}
);
});
I found some more information,and I'm going to post a second answer I found (above one was accepted).
If you want to avoid changing directories in windows/linux you can use cross-spawn: https://www.npmjs.com/package/cross-spawn
win-spawn (from the chat dialog) is not maintained anymore per the github repo . If you're interested in using it make the following changes:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With