When using npm install redwood stops working

After generating a new redwood-app I try to install a new module with npm install chart.js after this yarn rw dev stops working:

23:29:25 api | C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack\node_modules@babel\core\lib\config\full.js:168
23:29:25 api | throw e;
23:29:25 api | ^
23:29:25 api |
23:29:25 api | Error: [BABEL] C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack\api\src\functions\graphql.js: Cannot find module ‘babel-plugin-macros’ from ‘C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack’
23:29:25 api | at Function.resolveSync [as sync] (C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack\node_modules\resolve\lib\sync.js:81:15)
23:29:25 api | at resolveStandardizedName (C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack\node_modules@babel\core\lib\config\files\plugins.js:101:31)
23:29:25 api | at resolvePlugin (C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack\node_modules@babel\core\lib\config\files\plugins.js:54:10)
23:29:25 api | at loadPlugin (C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack\node_modules@babel\core\lib\config\files\plugins.js:62:20)
23:29:25 api | at createDescriptor (C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack\node_modules@babel\core\lib\config\config-descriptors.js:154:9)
23:29:25 api | at C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack\node_modules@babel\core\lib\config\config-descriptors.js:109:50
23:29:25 api | at Array.map ()
23:29:25 api | at createDescriptors (C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack\node_modules@babel\core\lib\config\config-descriptors.js:109:29)
23:29:25 api | at createPluginDescriptors (C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack\node_modules@babel\core\lib\config\config-descriptors.js:105:10)
23:29:25 api | at plugins (C:\Users\JanMechtel\Documents\projects\redwoodjs\olitrack\node_modules@babel\core\lib\config\config-descriptors.js:40:19) {

Also the npm output looks like I’m doing something wrong:

  • chart.js@2.9.3
    added 209 packages from 69 contributors, removed 331 packages, updated 1479 packages and audited >270583 packages in 167.434s

I can try to fix the module that can’t be found (babel-plugin-macros) but i feel like maybe I’m on the wrong track?

I managed to get this working by running npm install chart.js on an empty folder and copying it’s node_modules content into the node_modules of my redwood-app.

Not clean way, but working for now.

Hi @janmechtel

Mixing npm and yarn in the same project will cause you a lot of headaches, and likely won’t work.

Redwood uses Yarn as package manager, with two different default workspaces – web and api. To install chart.js, assuming you’re going to use it for the web part of your app, you should do yarn workspace web add chart.js.

Let me know if that works!


Oh thanks, my mighty ignorance, this will probably work then.

In my defense, I checked what’s webpack AND babel whether they are package managers, Yarn didn’t cross my mind as a candidate as I was using it for other stuff than “adding” packages etc.