Hello World Errors with Blocks-CLI

Hello Community,
Trying to create my first Airtable App by following the Hello World example and running into a number of npm errors and issues. If anyone can provide a bit of guidance on how to resolve this it would be greatly appreciated!

The first error occurs when trying to run

Airtable npm install -g @airtable/blocks-cli
npm WARN deprecated urix@0.1.0: P
npm WARN deprecated resolve-url@0.2.1:
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /usr/local/lib/node_modules/@airtable/blocks-cli/node_modules/loose-envify/cli.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod ‘/usr/local/lib/node_modules/@airtable/blocks-cli/node_modules/loose-envify/cli.js’
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

If I try to push past this and run
➜ Airtable block init app63J6OIpQdSMMn9/blk1y83B9jm8NXhd2 --template=https://github.com/Airtable/apps-hello-world hello_apps

I received another error “Cannot find module ‘extend’ Require stack…” Unfortunately, I’m unable to paste the full output of the require stack line as the community site limits the number of links I’m allowed to post and won’t allow me to submit my question with the additional information inline.

Hi Kyle, sorry you’re running into this! Could you let us know your operating system & the version of node and npm you’re using? You can find out your node/npm versions by running node --version and npm --version.

Hey @somehats thanks for the response! Info below:

macOS Catalina 10.15.7
NPM: 7.0.3
Node: v15.0.1

Please let me know if there is other info I can share.

Thanks! Unfortunately, the blocks CLI doesn’t support node version 15 yet. You could try downgrading your node version, or using a node version management tool like nodeenv or nvm to make it easier to switch between different node versions for different projects. Apologies for the inconvenience!

No inconvenience at all. If there is a way to update the SDK to output something to check the version and output a message notifying this requirement, you might help other users who run into this =]

Thanks for the help!

@somehats A follow-up question for you on this topic. Using NVM I installed Node version 14.15.0 and reinstalled the blocks-cli with success. However, when I tried to run block init, I ran into similar issues with “Cannot find module ‘extend’”.

➜ ~ block init / --template=https://github.com/Airtable/apps-hello-world hello_apps

:x: Error: Cannot find module ‘extend’
Require stack:

  • /usr/local/lib/node_modules/@airtable/blocks-cli/node_modules/postman-request/index.js
  • /usr/local/lib/node_modules/@airtable/blocks-cli/transpiled/src/helpers/init_command_helpers.js
    … (Cut additional output due to restrictions on how many “links” I can paste as a new user)

Is Node version 14.15.0 supported, or is there something else perhaps that I am missing?

Heh, that (or even better just fixing the issue) is definitely the plan :sweat_smile:

It looks like your system might still be using the old version of the block command that didn’t install properly from before… can you try removing the previously installed version? You might need to switch back to a non-nvm version of node before running npm uninstall @airtable/blocks-cli? Another easier but maybe riskier approach might be to rm -rf /usr/local/lib/node_modules/@airtable/blocks-cli

That did the trick, thank you @somehats!

And for anyone else who’s running into this issue: There’s a nice NVM start tutorial at https://itnext.io/nvm-the-easiest-way-to-switch-node-js-environments-on-your-machine-in-a-flash-17babb7d5f1b Make sure to run the command source ~/.nvm/nvm.sh after you install NVM to make sure it is fully installed and loaded. From there, just follow the instructions to load Node version 14.15.0, then follow @somehats instructions above to uninstall CLI-Blocks if needed, and finally run through the installation procedure again, and you should be golden.

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.