After playing around with nodeJs I have come back to my Craft CMS websites to work on other projects.
On executing "npm i", I was met by the below error
npm ERR! code 1
npm ERR! path /Users/michaelbutler/Sites/cardtwister-website/node_modules/favicons/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! TOUCH Release/obj.target/libvips-cpp.stamp
npm ERR! CXX(target) Release/obj.target/sharp/src/common.o
npm ERR! info sharp Using cached /Users/michaelbutler/.npm/_libvips/libvips-8.8.1-darwin-x64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@3.8.0
npm ERR! gyp info using node@16.13.1 | darwin | x64
npm ERR! (node:1501) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! gyp info spawn /usr/bin/python2
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/michaelbutler/Sites/cardtwister-website/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/michaelbutler/Sites/cardtwister-website/node_modules/favicons/node_modules/sharp/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/michaelbutler/Sites/cardtwister-website/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/michaelbutler/.node-gyp/16.13.1/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/michaelbutler/.node-gyp/16.13.1',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/michaelbutler/Sites/cardtwister-website/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/michaelbutler/.node-gyp/16.13.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/michaelbutler/Sites/cardtwister-website/node_modules/favicons/node_modules/sharp',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/common.cc:22:
npm ERR! In file included from /Users/michaelbutler/.node-gyp/16.13.1/include/node/node.h:63:
npm ERR! In file included from /Users/michaelbutler/.node-gyp/16.13.1/include/node/v8.h:30:
npm ERR! /Users/michaelbutler/.node-gyp/16.13.1/include/node/v8-internal.h:492: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! /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:710: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/sharp/src/common.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/michaelbutler/Sites/cardtwister-website/node_modules/node-gyp/lib/build.js:262:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:390: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 "/usr/local/bin/node" "/Users/michaelbutler/Sites/cardtwister-website/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /Users/michaelbutler/Sites/cardtwister-website/node_modules/favicons/node_modules/sharp
npm ERR! gyp ERR! node -v v16.13.1
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/michaelbutler/.npm/_logs/2021-12-07T11_44_09_876Z-debug.log
Is from a conflict with node versions. As I result, I have tried brew install node@14 to step down versions, but brew link did not seem to work / did not resolve this error.
Any advise would be greatly appreciated.
The issue seems to also occur when trying to install "Sharp" individually (i.e. npm install sharp)
Here is my package.json, as this will likely be required
{
"name": "doodle-craft-puppy",
"version": "0.1.0",
"homepage": "https://doodle-je@bitbucket.org/doodledevelopers/doodle-craft-puppy.git",
"repository": {
"type": "git",
"url": "https://doodle-je@bitbucket.org/doodledevelopers/doodle-craft-puppy.git"
},
"babel": {
"presets": [
[
"@babel/preset-env",
{
"targets": {
"browsers": [
"last 2 versions",
"Explorer 10"
]
}
}
]
]
},
"eslintConfig": {
"env": {
"browser": true,
"es6": true
},
"parserOptions": {
"sourceType": "module"
}
},
"browserslist": [
"last 1 version",
"> 1%"
],
"description": "Doodle's Project Scaffold for craft",
"author": "doodle",
"main": "gulpfile.js",
"license": "MIT",
"paths": {
"src": {
"scss": "./src/scss/**/*.scss",
"images": "./src/images/",
"fonts": "./src/fonts/*",
"svgs": "./src/icons/svg/**/*.svg",
"templates": "./templates/**/*.{html,twig}",
"js": [
"./src/js/app.js"
]
},
"build": {
"base": "./web/",
"css": "./web/build/css/",
"images": "./web/build/images/",
"fonts": "./web/build/fonts/",
"svgs": "./web/build/icons/svg/",
"js": "./web/build/js/"
},
"favicon": {
"src": "./src/favicons/favicon.png",
"dest": "./web/favicons/",
"path": "/img/site/"
},
"craftConfig": "./config/"
},
"urls": {
"live": "http://card-twister.com/",
"local": "http://cardtwister-website:8888/"
},
"devDependencies": {
"@babel/cli": "^7.14.8",
"@babel/core": "^7.14.8",
"@babel/preset-env": "^7.14.9",
"@babel/register": "^7.14.5",
"babel-eslint": "^10.1.0",
"babelify": "^10.0.0",
"barba.js": "^1.0.0",
"body-scroll-lock": "^2.6.4",
"browser-sync": "^2.27.5",
"browserify": "^16.5.2",
"browserslist": "^4.16.7",
"del": "^4.1.1",
"domready": "^1.0.8",
"fancy-log": "^1.3.2",
"gulp": "^4.0.2",
"gulp-autoprefixer": "^6.1.0",
"gulp-babel": "^8.0.0",
"gulp-better-rollup": "^4.0.1",
"gulp-cached": "^1.1.1",
"gulp-cheerio": "^0.6.3",
"gulp-concat": "^2.6.1",
"gulp-cssnano": "^2.1.3",
"gulp-eslint": "^5.0.0",
"gulp-favicons": "^2.4.0",
"gulp-flatten": "^0.4.0",
"gulp-if": "^2.0.2",
"gulp-imagemin": "^6.2.0",
"gulp-load-plugins": "^1.5.0",
"gulp-plumber": "^1.1.0",
"gulp-postcss": "^8.0.0",
"gulp-purgecss": "^1.2.0",
"gulp-rename": "^1.4.0",
"gulp-replace": "^1.1.3",
"gulp-sass": "^5.0.0",
"gulp-size": "^3.0.0",
"gulp-sourcemaps": "^2.2.1",
"gulp-svg-symbols": "^3.2.0",
"gulp-svgstore": "^7.0.0",
"gulp-tap": "1.0.1",
"gulp-uglify": "^3.0.2",
"gulp-util": "^3.0.8",
"regenerator-runtime": "^0.13.9",
"smooth-scroll": "github:cferdinandi/smooth-scroll",
"svgxuse": "^1.2.6",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0",
"waypoints": "^4.0.1"
},
"dependencies": {
"browser-update": "^3.3.30",
"intersection-observer": "^0.7.0",
"inuitcss": "^6.0.0",
"jquery": "^3.6.0",
"menuspy": "^1.3.0",
"sass-rem": "^2.0.1",
"sftp-sync-deploy": "^0.7.1",
"vanilla-lazyload": "^16.1.0"
}
}