5

I'm trying to run a legacy React app locally for the first time. I'm on a new Mac M1 with Big Sur 11.5.2. My node version is 16.9.0, and I made python3 the default (although the app seems to be looking for python2). I also upgraded CommandLineTools to the latest version.

But when I do a simple npm install, I get lots of warnings, and finally this error:

npm ERR! /Users/cd/.node-gyp/16.9.0/include/node/v8-internal.h:489:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
npm ERR!             !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR!                                 ~~~~~^~~~~~~~~~~
npm ERR!                                      remove_cv
npm ERR! /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:776:50: note: 'remove_cv' declared here
npm ERR! template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
npm ERR!                                                  ^
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/binding/src/binding.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack     at ChildProcess.onExit (/Users/cd/develop/storybook/webclient/node_modules/node-gyp/lib/build.js:262:23)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Darwin 20.6.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/16.9.0/bin/node" "/Users/cd/develop/storybook/webclient/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd /Users/cd/develop/storybook/webclient/node_modules/node-sass
npm ERR! gyp ERR! node -v v16.9.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok 
npm ERR! Build failed with error code: 1

I'm not proficient enough with node to understand exactly how to troubleshoot this, beyond the steps I've already taken. Clearly something is wrong with node-sass, so I installed it separately with:

sudo npm install --unsafe-perm -g node-sass

That works, but when I re-run npm install to get all the dependencies, I get the same error.

Wai Ha Lee
  • 8,598
  • 83
  • 57
  • 92
CNDyson
  • 1,687
  • 7
  • 28
  • 63

2 Answers2

5

Upgrade node-sass to a version higher than 6.0.1 (mine was 4.0.0) solves this issue

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

phuongtm
  • 379
  • 3
  • 9
0

try this

rm -rf node_modules package-lock.json 
npm install --saveDev node-sass 
npm install
Asanka
  • 1,628
  • 1
  • 10
  • 20
  • 2
    When I run the second command, I get the exact same error. – CNDyson Sep 13 '21 at 19:08
  • U can try with --unsafe-perm with the second command. But I'm not sure. In your case you are installing node saas globally. Then executing local npm installing. – Asanka Sep 13 '21 at 19:15
  • Is the problem I'm having a versioning issue?? – CNDyson Sep 13 '21 at 19:15
  • 1
    Not sure. But this article have some explanations. https://programmer.group/why-does-node-sass-always-fail-to-install.html – Asanka Sep 13 '21 at 19:18