error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'? error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'? xcode xcode

error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?


Update: Since node-sass version 6.0.1, Node 16 is supported. Updating node-sass to a version higher than 6.0.1 solves this issue.


What you're seeing is an error during compilation of node-sass. That's a package processing your Sass/SCSS styles, which is written in C++ and only re-packaged as a JavaScript library. The fact it's written in C++ means it needs to be compiled on your device during installation (this is internally done by a tool called node-gyp, which you can spot in your error output, too).

The problem is node-sass doesn't support Node 16 as of writing this answer, see tracking issue: https://github.com/sass/node-sass/issues/3077 There's no estimate on when it's gonna support it (and that's fair, as it's a volunteer-driven project). Even if you manage to install node-sass on Node 16, I'd advice against it, as the behavior might be undefined.

The correct solution is to downgrade your Node installation to a supported version (I can see both 14 and 15 tested in their CI). If you git cloned a project and it won't install on your machine, but works for your colleagues or on the production server, it's likely the project has a different version of Node in mind too, and isn't tested on Node 16, so I'd advice against developing it on Node 16 anyway. If the project worked for you just a few days ago, but it doesn't work now, it's very likely you recently upgraded your system setup (e.g. Homebrew), which upgraded you to Node 16 (this is what happened to me and how I found this question).

You should check with the authors of the project what's the production server version of Node it runs on and install that version locally, too. As a best practice, in the future, keep the production version and your local version of Node (and yarn or npm) in sync. For managing multiple Node versions, you can use this tool https://github.com/nvm-sh/nvm


node-sass is not yet compatible with node v16

A wise thing to do is to downgrade node (e.g. to version 14) until node-sass is compatible with v16. To downgrade node using nvm, simply run:

nvm install 14

Set version 14 globally (so each new terminal windows defaults to node version 14) by running:

nvm alias default 14

Now you have node 14 installed and set as default! ..now you just need to make your app use v14.


How to make your rails app use node 14

Install node 14 (see above). Open terminal and head to your app's root directory, then:

  1. Stop your rails server if it's running
  2. Open a fresh new terminal window (so that node --version returns 14.x (not 16)
  3. Run spring stop
  4. Delete yarn.lock
  5. Remove existing node modules with rm -rf node_modules
  6. Check that node --version returns 14. If it doesn't run nvm install 14 again.
  7. Now reinstall modules with yarn install (if you don't have yarn for node 14, install it with npm install --global yarn)
  8. It should succeed!
  9. Restart your rails server, and it will work!


Revert to the latest Node v14 LTS for using node-sass:

brew install node@14brew unlink nodebrew link node@14node -vspring stop

Run in your Rails project:

yarn install

PS: Node 16 has an errors with node-sass https://github.com/nodejs/node/issues/38367#issuecomment-825461899