Error when trying to install the rocket chat SDK

I’m trying to add Rocket.Chat.js.SDK as a dependency, but when running the command indicated in the documentation , the following error returns:

npm install @rocket.chat/sdk

You cannot use the ‘@’ operator to reference variables in an expression. ‘@rocket’ can only be used as an argument
for a command. To reference variables in an expression, use ‘$rocket’.

Documentation link: https://developer.rocket.chat/bots/creating-your-own-bot-from-scratch/develop-a-rocket.chat-sdk-bot

Server Setup Information

  • Version of Rocket.Chat Server: 6.7.1
  • Operating System: Windows
  • NodeJS Version: v20.13.1

Did you check the repo as well?

yes, and even running the command informed in the repository returns the same error, this is the first time I have come across this type of problem but I tried some possible solutions such as changing the @ to $ or putting the command npm install ‘@rocket.chat/ sdk’ --save with single quotes at the beginning and end of the sdk but I was not successful

Hmmm.

I just tried myself to test on a Linux box.

john@testbox:~$ cd git
john@testbox:~/git$ mkdir bot
john@testbox:~/git$ cd bot
john@testbox:~/git/bot$ npm init -y
Wrote to /home/john/git/bot/package.json:

{
  "name": "bot",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "description": ""
}

john@testbox:~/git/bot$ npm install @rocket.chat/sdk

added 21 packages, and audited 22 packages in 8s

2 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

john@testbox:~/git/bot$ 

john@testbox:~/git/bot$ ll
total 28
drwxrwxr-x  3 john john 4096 May 22 14:35 ./
drwxrwxr-x  8 john john 4096 May 22 14:21 ../
drwxrwxr-x 22 john john 4096 May 22 14:35 node_modules/
-rw-rw-r--  1 john john 8457 May 22 14:35 package-lock.json
-rw-rw-r--  1 john john  277 May 22 14:35 package.json

I created the server.js and reply.js files and it came up immediately.

john@testbox:~/git/bot$ node server.js
[connect] Connecting {
  username: 'bot',
  password: 'pass',
  ldap: false,
  host: '<ROCKETCHAT HOST>',
  useSsl: '<SSL USAGE>',
  timeout: 20000,
  rooms: [],
  allPublic: false,
  dm: false,
  livechat: false,
  edited: false,
  integrationId: 'js.SDK',
  roomCacheMaxSize: 10,
  roomCacheMaxAge: 300000,
  dmCacheMaxSize: 10,
  dmCacheMaxAge: 100000
}

Not sure how successful it is on native Windows. Try it with WSL or use Glitch.