Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of jbrowse-cli on node 10.9 related to fs.promises #1461

Merged
merged 1 commit into from
Nov 19, 2020

Conversation

cmdcolin
Copy link
Collaborator

Fixes #1440

This is kind of a weird one but

nvm install 10.9
yarn
cd products/jbrowse-cli
bin/run create t1
bin/run add-assembly volvox.fa --out t1

This fails with the lstat error described in #1440

With this PR though it is fixed

Note that yarn test products/jbrowse-cli does not pass with node 10.9 still due to something weird about testUtil, full error


    TypeError: Patterns must be a string or an array of strings



      at assertPatternsInput (node_modules/globby/index.js:17:9)
      at generateGlobTasks (node_modules/globby/index.js:42:2)
      at Object.<anonymous>.module.exports (node_modules/globby/index.js:116:20)
      at Object.<anonymous>.module.exports (node_modules/del/index.js:66:23)
      at _callee2$ (products/jbrowse-cli/src/testUtil.ts:128:37)
      at tryCatch (node_modules/regenerator-runtime/runtime.js:63:40)
      at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:293:22)
      at Generator.next (node_modules/regenerator-runtime/runtime.js:118:21)
      at asyncGeneratorStep (node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)
      at _next (node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)
      at node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/asyncToGenerator.js:32:7
      at node_modules/babel-preset-react-app/node_modules/@babel/runtime/helpers/asyncToGenerator.js:21:12
      at products/jbrowse-cli/src/testUtil.ts:144:18
      at Object.finally (node_modules/fancy-test/lib/base.js:112:117)
      at Object.run (node_modules/fancy-test/lib/base.js:79:36)


That goes back to something in the del command/package I think

@cmdcolin
Copy link
Collaborator Author

Note that 10.9 also prints out the warning "(node:109940) ExperimentalWarning: The fs.promises API is experimental" so this is early days of node. Also, can't replace del with fs.rmdir with recursive:true option because that was added in like 10.12 to sidestep the del failing

@codecov
Copy link

codecov bot commented Nov 19, 2020

Codecov Report

Merging #1461 (1af6189) into master (4d4f941) will increase coverage by 0.04%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1461      +/-   ##
==========================================
+ Coverage   59.76%   59.80%   +0.04%     
==========================================
  Files         426      426              
  Lines       19086    19093       +7     
  Branches     4371     4371              
==========================================
+ Hits        11406    11418      +12     
+ Misses       7386     7381       -5     
  Partials      294      294              
Impacted Files Coverage Δ
packages/core/ui/FactoryResetDialog.tsx 22.22% <ø> (ø)
products/jbrowse-web/src/Loader.tsx 70.46% <0.00%> (ø)
products/jbrowse-web/src/StartScreen.tsx 48.57% <ø> (ø)
packages/core/ui/FatalErrorDialog.tsx 84.61% <100.00%> (+42.94%) ⬆️
products/jbrowse-cli/src/commands/add-assembly.ts 90.69% <100.00%> (+0.04%) ⬆️
...roducts/jbrowse-cli/src/commands/add-connection.ts 92.55% <100.00%> (+0.08%) ⬆️
products/jbrowse-cli/src/commands/add-track.ts 46.19% <100.00%> (+0.25%) ⬆️
products/jbrowse-cli/src/commands/admin-server.ts 95.89% <100.00%> (+0.05%) ⬆️
products/jbrowse-cli/src/commands/create.ts 88.09% <100.00%> (+0.29%) ⬆️
...ts/jbrowse-cli/src/commands/set-default-session.ts 95.91% <100.00%> (+0.08%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a691938...1af6189. Read the comment docs.

@cmdcolin
Copy link
Collaborator Author

cmdcolin commented Nov 19, 2020

Note also that using

nvm install 10.0

This does not work and produces an lstat error

~/s/j/p/jbrowse-cli ❯❯❯ nvm use 10.0                                                                                                                                                  ✘ 160
Now using node v10.0.0 (npm v5.6.0)
~/s/j/p/jbrowse-cli ❯❯❯ bin/run add-assembly volvox.fa --out ../../test_data --load copy
    TypeError: Cannot read property 'lstat' of undefined

@cmdcolin
Copy link
Collaborator Author

So this basically adds a little more node 10 compatibility at the price of a little weirdness (I am not even sure why this alternative import style works in this case)

@garrettjstevens
Copy link
Collaborator

Interesting. It would be good if we could enforce this with a lint rule or something, but I'm not sure if there's an easy way to do that.

@rbuels
Copy link
Contributor

rbuels commented Nov 19, 2020

do the TS compiler params for the CLI perhaps need to be tweaked? maybe they are targeting a more recent node version, and that's why the previous import statements don't work?

@cmdcolin
Copy link
Collaborator Author

To me, this problem is indicative of some wild stuff that is slightly before fs.promises got standardized

This means we could

a) Take this PR as is, establish 10.9 or something like that as a minimum, and disallow 10.0
b) Just discard this PR, and establish 10.12 or something like that (haven't checked) as a minimum

@rbuels
Copy link
Contributor

rbuels commented Nov 19, 2020

well it's a net improvement, so merged

@rbuels rbuels merged commit 06a36ff into master Nov 19, 2020
@rbuels rbuels deleted the fix_node10.9 branch November 19, 2020 19:32
@garrettjstevens garrettjstevens added the bug Something isn't working label Nov 23, 2020
@cmdcolin cmdcolin changed the title Alternative fsPromises usage Fix usage of jbrowse-cli on node 10.9 using alternative fs.promises import Nov 24, 2020
@cmdcolin cmdcolin changed the title Fix usage of jbrowse-cli on node 10.9 using alternative fs.promises import Fix usage of jbrowse-cli on node 10.9 related to fs.promises Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read property 'lstat' of undefined
3 participants