0

i am trying to run npm install command on my project and i keep getting an error i do not understand, please i need help on getting to the root of the error.

my package.json

  "devDependencies": {
    "babel-core": "^6.25.0",
    "babel-loader": "^7.1.1",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-polyfill": "^6.23.0",
    "babel-preset-env": "^1.6.0",
    "serverless-bundle": "^1.3.3",
    "serverless-pseudo-parameters": "^2.5.0",
    "webpack": "^4.35.2"
  },
  "dependencies": {
    "@middy/core": "^2.2.0",
    "@middy/http-cors": "^2.2.0",
    "@middy/http-error-handler": "^2.2.0",
    "@middy/http-event-normalizer": "^2.2.0",
    "@middy/http-json-body-parser": "^2.2.0",
    "@middy/validator": "^2.2.0",
    "aws-sdk": "^2.639.0",
    "decimal.js": "^10.2.1",
    "http-errors": "^1.8.0"
  }

The error i keep getting:

npm ERR! code 1
npm ERR! path PROJECT_PATH/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /Users/dami/.nvm/versions/node/v16.2.0/bin/node /Users/dami/dev/capitack/capitack-backend/orderbook-service/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR!   c++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_DARWIN_USE_64_BIT_INODE=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.5"' -I/Users/dami/.node-gyp/16.2.0/include/node -I/Users/dami/.node-gyp/16.2.0/src -I/Users/dami/.node-gyp/16.2.0/deps/openssl/config -I/Users/dami/.node-gyp/16.2.0/deps/openssl/openssl/include -I/Users/dami/.node-gyp/16.2.0/deps/uv/include -I/Users/dami/.node-gyp/16.2.0/deps/zlib -I/Users/dami/.node-gyp/16.2.0/deps/v8/include -I../src/libsass/include  -O3 -gdwarf-2 -mmacosx-version-min=10.7 -arch x86_64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=c++11 -stdlib=libc++ -fno-strict-aliasing -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp

Please i really need help with solving this issue.

  • Is [this](https://stackoverflow.com/questions/28701753/difficulty-solving-sh-npm-package-name-command-not-found-with-npm-run-npm) any help? – Lucas Mendonca May 23 '21 at 17:59
  • are you missing build-essential maybe? Does anything c++ related compile? – Wyck May 23 '21 at 18:05
  • im not really sure, all im using is javascript with the serverless framework here –  May 23 '21 at 18:07
  • But this module is using node-gyp to build some native component (using C++) so it's possible that some other packages need to be installed as prerequisites for the module to build on the platform you are building it for. What platform are you building on/for and which specific version of node-sass did it pull in? node-sass is [a fussy one](https://github.com/sass/node-sass#node-version-support-policy) with respect to versions matching. – Wyck May 23 '21 at 18:17
  • As a test, just `npm install node-sass` in a new empty folder and see if your machine can build it. – Wyck May 23 '21 at 18:18

2 Answers2

1

I fixed the error, as it appears the error occurred because i was using node 16> so i tried downgrading to node 14> using nvm and it worked just fine!. Thanks to everyone for helping out

-1

try with sudo command if you are using linux based systems

sudo npm i

else try to run it with full previlage in windows based system.

  • ive tried using sudo still getting the same error –  May 23 '21 at 18:04
  • Try it after updating your npm version to either latest stable version I hope there is some deprecation in npm package which causing the error. – D.R.Venkateshwar May 23 '21 at 18:09
  • i can also see some GYP ERR errors coming out, any knowledge as to what that means? –  May 23 '21 at 18:12
  • I have no idea about that But try with updating the node package too to the latest LTS or stable version That resolves the GYP ERR Refer [here](https://stackoverflow.com/questions/33896511/npm-install-fails-with-node-gyp) – D.R.Venkateshwar May 23 '21 at 18:20
  • Installing package dependencies with `sudo` is never the correct answer. – Thomas Sablik May 23 '21 at 20:02