In Windows, npm start often fails to start the dev server, logging The dev server is already running on port 3000, even though it's been stopped with npm stop before. Only the first npm stop call shows that it found a process id to stop, so the server is indeed being stopped correctly.
In Windows,
npm start
often fails to start the dev server, loggingThe dev server is already running on port 3000
, even though it's been stopped withnpm stop
before. Only the firstnpm stop
call shows that it found a process id to stop, so the server is indeed being stopped correctly.The issue is caused by
getProcessIdsForPort()
often returning[ 0 ]
and interpreting it as there's a pid so the server is still running, since the line being parsed contains a trailing "\r" which breaks the check!== '0'
in https://github.com/OfficeDev/Office-Addin-Scripts/blob/master/packages/office-addin-debugging/src/port.ts#L78Logging the parts being parsed in
getProcessIdsForPort()
shows this:processId.trim()
fixes the check and can be called since we've already guarded againstundefined
before.This PR does not impact command syntax or documentation. Testing has been done manually on Win32 (the change affects Windows only)