botpress / v12

Botpress OSS – v12
https://v12.botpress.com
GNU Affero General Public License v3.0
78 stars 87 forks source link

Adding NPM packages via the 'Libraries' tab fails with error #1568

Closed Banbury closed 2 years ago

Banbury commented 2 years ago

Describe the bug Adding a library via the 'Libraries' tab or manually in package.json (and then pressing 'Synchronize'), fails with the following error message:

12/11/2021 08:36:05.921 [Studio] HTTP Syncing libraries...
12/11/2021 08:36:06.284 [Studio] HTTP Command executed successfully: internal/modules/cjs/loader.js:967
     throw err;
     ^

   Error: Cannot find module 'npmlog'
   Require stack:
   - C:\Users\snoopy\AppData\Roaming\botpress\npm\bin\npm-cli.js
       at Function.Module._resolveFilename (internal/modules/cjs/loader.js:964:15)
       at Function.Module._load (internal/modules/cjs/loader.js:840:27)
       at Module.require (internal/modules/cjs/loader.js:1024:19)
       at require (internal/modules/cjs/helpers.js:72:18)
       at C:\Users\snoopy\AppData\Roaming\botpress\npm\bin\npm-cli.js:22:13
       at Object.<anonymous> (C:\Users\snoopy\AppData\Roaming\botpress\npm\bin\npm-cli.js:155:3)
       at Module._compile (internal/modules/cjs/loader.js:1136:30)
       at Object.Module._extensions..js (internal/modules/cjs/loader.js:1156:10)
       at Module.load (internal/modules/cjs/loader.js:984:32)
       at Function.Module._load (internal/modules/cjs/loader.js:877:14) {
     code: 'MODULE_NOT_FOUND',
     requireStack: [
       'C:\\Users\\snoopy\\AppData\\Roaming\\botpress\\npm\\bin\\npm-cli.js'
     ]
                             }

To Reproduce Steps to reproduce the behavior:

  1. Open the 'Library' tab.
  2. Press the add button
  3. Select 'Type a custom command'
  4. enter 'install underscore'
  5. Press 'Execute' (BTW 'Search library on NPM (recommended)' is missing the 'Execute' button)
  6. A message 'Command execution completed' pops up.
  7. The library is not added and package.json is not updated.
  8. In the console window the error message is displayed.

Expected behavior The package is installed and displayed in the 'Libraries' tab. The dependencies in the file package.json are updated.

Environment (please complete the following information):

laurentlp commented 2 years ago

@Banbury thanks for filling this issue, this is a known bug. I will close it for now. Please refer to this issue for updates: https://github.com/botpress/v12/issues/1586

suzuya1331 commented 2 years ago

hello , I have same issue but I found solution u can work with until they fix the issue

inside Botpress file go to library directory

cd ./data/bots/{{your-bot-name}}/libraries

install npmlog

npm i npmlog

this will fix the issue , if it not showing after the installing lib , just restart Botpress.