facebook / memlab

A framework for finding JavaScript memory leaks and analyzing heap snapshots
https://facebook.github.io/memlab/
MIT License
4.36k stars 119 forks source link

Build failure on windows #12

Closed phalgunv closed 1 year ago

phalgunv commented 2 years ago

Hello,

I was following the instructions at https://facebookincubator.github.io/memlab/docs/guides/guides-detached-dom and the npm run build command failed. I am running the command on the Windows 10 using Powershell. Please see the command output.

`PS C:\code\memlab> npm run build

@memlab/monorepo@1.0.0 build C:\code\memlab npm run clean > /dev/null && npm run build-pkg --workspaces

The system cannot find the path specified. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @memlab/monorepo@1.0.0 build: npm run clean > /dev/null && npm run build-pkg --workspaces npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @memlab/monorepo@1.0.0 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\pvaddepa\AppData\Roaming\npm-cache_logs\2022-09-12T20_21_26_708Z-debug.log`

The command npm run clean > /dev/null fails as below: `PS C:\code\memlab> npm run clean > /dev/null out-file : Could not find a part of the path 'C:\dev\null'. At line:1 char:1

When I ran npm run clean I could see that there was an error message asking to upgrade node version to 16+.

`PS C:\code\memlab> npm run clean

@memlab/monorepo@1.0.0 clean C:\code\memlab npm run clean-pkg --workspaces && rm -rf ./website/build

@memlab/monorepo@1.0.0 clean-pkg C:\code\memlab npm run error

@memlab/monorepo@1.0.0 error C:\code\memlab echo 'upgrade node.js to version 16.0.0 or above. Consider using nvm.'; exit 1

'upgrade node.js to version 16.0.0 or above. Consider using nvm.'; exit 1 'rm' is not recognized as an internal or external command, operable program or batch file. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @memlab/monorepo@1.0.0 clean: npm run clean-pkg --workspaces && rm -rf ./website/build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @memlab/monorepo@1.0.0 clean script.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\pvaddepa\AppData\Roaming\npm-cache_logs\2022-09-12T20_26_27_043Z-debug.log`

After removing "/dev/null", I see below error as rm is being used to delete the directorys: `PS C:\code\memlab> npm run clean

@memlab/monorepo@1.0.0 clean npm run clean-pkg --workspaces && rm -rf ./website/build

@memlab/core@1.1.10 clean-pkg rm -rf ./dist && rm -rf ./node_modules && rm -f ./tsconfig.tsbuildinfo

'rm' is not recognized as an internal or external command,`

I had to switch to Git Bash to run the commands and I get below error.

`$ npm run build

@memlab/monorepo@1.0.0 build npm run clean > /dev/null && npm run build-pkg --workspaces

The system cannot find the path specified. `

I removed "> /dev/null" to make it work.

So, the issues I see is

  1. The documentation should be updated to mention the minimum node.js version and on Windows the command should be run using Git Bash.
  2. The Unix style redirection of stdout does not work on Powershell.
  3. The stdout should not be suppressed (> /dev/null).

Enhancements,

  1. It would be nice to add .nvmrc file in the repository.
  2. Support for running in Powershell.