profiler icon indicating copy to clipboard operation
profiler copied to clipboard

Yarn test & start not working on Windows

Open squelart opened this issue 7 years ago • 2 comments

I installed Yarn on Windows 10 using their installer: https://yarnpkg.com/en/docs/install#windows-stable I'm using MozillaBuild (which is based on mingw's msys) as unixy command line and tools, including node&npm.

yarn --version outputs:

/c/PROGRA~2/Yarn/bin/yarn: line 3: readlink: command not found
1.12.1

`yarn start works fine and installs all dependencies without visible issues.

yarn test fails with with many of the same error:

 FAIL  src/test/unit/symbol-store.test.js
  ● Test suite failed to run

    SyntaxError: C:\mozilla-source\external\perf.html\src\test\setup.js: Unexpected token, expected "," (19:46)

      17 |   // This `__shutdownWorkers` function only exists in the mocked test environment,
      18 |   // do not use flow typing on it.
    > 19 |   const { __shutdownWorkers } = (WorkerFactory: Object);
         |                                               ^
      20 |   __shutdownWorkers();
      21 | });
      22 |

      at Parser.raise (node_modules/@babel/parser/lib/index.js:3938:15)
      at Parser.unexpected (node_modules/@babel/parser/lib/index.js:5247:16)
      at Parser.expect (node_modules/@babel/parser/lib/index.js:5235:28)
      at Parser.parseParenAndDistinguishExpression (node_modules/@babel/parser/lib/index.js:6453:14)
      at Parser.parseExprAtom (node_modules/@babel/parser/lib/index.js:6283:21)
      at Parser.parseExprSubscripts (node_modules/@babel/parser/lib/index.js:5923:21)
      at Parser.parseMaybeUnary (node_modules/@babel/parser/lib/index.js:5902:21)
      at Parser.parseExprOps (node_modules/@babel/parser/lib/index.js:5811:21)
      at Parser.parseMaybeConditional (node_modules/@babel/parser/lib/index.js:5783:21)
      at Parser.parseMaybeAssign (node_modules/@babel/parser/lib/index.js:5730:21)And `yarn start` quickly fails too:```/c/PROGRA~2/Yarn/bin/yarn: line 3: readlink: command not found

yarn run v1.12.1 $ yarn build:clean && cross-env NODE_ENV=development node server.js $ rimraf dist && mkdirp dist events.js:183 throw er; // Unhandled 'error' event ^

Error: listen EACCES 127.0.0.1:4242 at Object._errnoException (util.js:1022:11) at _exceptionWithHostPort (util.js:1044:20) at Server.setupListenHandle [as _listen2] (net.js:1350:19) at listenInCluster (net.js:1408:12) at GetAddrInfoReqWrap.doListen [as callback] (net.js:1517:7) at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:97:10) error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.


I'm currently using Linux in a VM to run yarn and perf.html, so I'm not stuck, but it'd be great if I could run it directly in Windows.



┆Issue is synchronized with this [Jira Task](https://mozilla-hub.atlassian.net/browse/FP-82)

squelart avatar Nov 07 '18 20:11 squelart

@julienw suggested trying Windows Subsystem for Linux; will have to look into that!

squelart avatar Nov 07 '18 21:11 squelart

It's weird that yarn is trying to use readlink. My thought is that maybe yarn thinks it runs on Unix because of MozillaBuild.

So here's something else you can try:

  1. install node and npm the "windows" way, possibly with using nvm-windows (https://github.com/coreybutler/nvm-windows), or chocolatey (see yarn instruction about chocolatey in https://yarnpkg.com/fr/docs/install#windows-stable)
  2. install yarn the "windows" way
  • if you used nvm-windows, they say you should use npm install -g yarn. I think they recommend this way to make sure yarn gets installed in the "right" node environment (as nvm is used to manage different environments).
  • if you installed node with their msi, you can also install yarn using their msi
  • if you want to use chocolatey, you can also install yarn this way, which should install node along the way

If I suggest nvm-windows, that's because I use nvm on Linux and I'm very satisfied about it, as it makes it very easy to switch between node versions and to upgrade node as well. If instead you decide to install node globally, it's much more difficult to switch between versions.

Folks from the yarn environment suggest to whitelist the yarn cache directory as well as the project directory in the antivirus configuration to make all operations faster.

julienw avatar Nov 08 '18 16:11 julienw