[英]npm: command not found when executing commands in Electron app
我正在开发一个电子应用程序,并且在该应用程序内,我使用child_process.exec
执行shell命令。 我运行的命令之一是npm run start
; 这在开发环境中完美地工作,但是当我为生产环境构建应用程序时,所有npm
命令都失败,并显示以下错误:
Error: Command failed: npm run start
/bin/sh: npm: command not found
at ChildProcess.exithandler (child_process.js:287)
at emitTwo (events.js:126)
at ChildProcess.emit (events.js:214)
at maybeClose (internal/child_process.js:925)
at Socket.stream.socket.on (internal/child_process.js:346)
at emitOne (events.js:116)
at Socket.emit (events.js:211)
at Pipe._handle.close [as _onclose] (net.js:554)
我尝试通过运行以下命令open MyApp.app/Contents/MacOS/MyApp
以调试模式运行该应用程序,并且npm
命令成功运行且没有错误。
可能是什么问题?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.