I was following the tutorial and had issues on the "npm install" step [1]. I searched around and it looks like the issue is some kind of incompatibility between old versions of "node-sass" and new versions of Node.js. I updated the dependency versions in "package.json" to the latest available (as of today) and "npm install" worked.
Based on the stuff I found online, a bunch of people will probably have this issue. How about updating the package.json to the latest? Mine currently looks like:
npm WARN deprecated graceful-fs@2.0.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN deprecated lodash@1.0.2: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0.
npm WARN deprecated graceful-fs@1.2.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
> node-sass@0.9.3 install /Users/kannan/Develop/gift-website/node_modules/node-sass
> node build.js
(node) child_process: options.customFds option is deprecated. Use options.stdio instead.
CXX(target) Release/obj.target/binding/binding.o
In file included from ../binding.cpp:1:
../../nan/nan.h:337:54: error: too many arguments to function call, expected at most 2, have 4
return v8::Signature::New(nan_isolate, receiver, argc, argv);
~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~
/Users/kannan/.node-gyp/5.7.0/include/node/v8.h:4674:3: note: 'New' declared here
static Local<Signature> New(
^
In file included from ../binding.cpp:1:
../../nan/nan.h:409:19: error: no type named 'ExternalAsciiStringResource' in 'v8::String'; did you mean 'ExternalStringResource'?
v8::String::ExternalAsciiStringResource *resource) {
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
ExternalStringResource
/Users/kannan/.node-gyp/5.7.0/include/node/v8.h:2207:19: note: 'ExternalStringResource' declared here
class V8_EXPORT ExternalStringResource
^
In file included from ../binding.cpp:1:
../../nan/nan.h:408:36: error: redefinition of 'NanNew'
NAN_INLINE v8::Local<v8::String> NanNew(
^
../../nan/nan.h:403:36: note: previous definition is here
NAN_INLINE v8::Local<v8::String> NanNew(
^
../../nan/nan.h:427:3: error: redefinition of 'NanNew'
NanNew<v8::StringObject, v8::Handle<v8::String> >(
^
../../nan/nan.h:420:3: note: previous definition is here
NanNew<v8::StringObject, v8::Local<v8::String> >(
^
../../nan/nan.h:444:36: error: redefinition of 'NanNew'
NAN_INLINE v8::Local<v8::RegExp> NanNew(
^
../../nan/nan.h:438:36: note: previous definition is here
NAN_INLINE v8::Local<v8::RegExp> NanNew(
^
../../nan/nan.h:456:36: error: redefinition of 'NanNew'
NAN_INLINE v8::Local<v8::RegExp> NanNew(
^
../../nan/nan.h:450:36: note: previous definition is here
NAN_INLINE v8::Local<v8::RegExp> NanNew(
^
../../nan/nan.h:767:13: error: no member named 'smalloc' in namespace 'node'
, node::smalloc::FreeCallback callback
~~~~~~^
../../nan/nan.h:777:12: error: no matching function for call to 'New'
return node::Buffer::New(nan_isolate, data, size);
^~~~~~~~~~~~~~~~~
/Users/kannan/.node-gyp/5.7.0/include/node/node_buffer.h:31:40: note: candidate function not viable: no known conversion from
'uint32_t' (aka 'unsigned int') to 'enum encoding' for 3rd argument
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
/Users/kannan/.node-gyp/5.7.0/include/node/node_buffer.h:43:40: note: candidate function not viable: 2nd argument ('const char *')
would lose const qualifier
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
/Users/kannan/.node-gyp/5.7.0/include/node/node_buffer.h:28:40: note: candidate function not viable: requires 2 arguments, but 3
were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
^
/Users/kannan/.node-gyp/5.7.0/include/node/node_buffer.h:36:40: note: candidate function not viable: requires 5 arguments, but 3
were provided
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
^
In file included from ../binding.cpp:1:
../../nan/nan.h:781:12: error: no viable conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object>'
return node::Buffer::New(nan_isolate, size);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/kannan/.node-gyp/5.7.0/include/node/v8.h:210:7: note: candidate constructor (the implicit copy constructor) not viable: no
known conversion from 'v8::MaybeLocal<v8::Object>' to 'const v8::Local<v8::Object> &' for 1st argument
class Local {
^
/Users/kannan/.node-gyp/5.7.0/include/node/v8.h:210:7: note: candidate constructor (the implicit move constructor) not viable: no
known conversion from 'v8::MaybeLocal<v8::Object>' to 'v8::Local<v8::Object> &&' for 1st argument
class Local {
^
/Users/kannan/.node-gyp/5.7.0/include/node/v8.h:214:13: note: candidate template ignored: could not match 'Local' against
'MaybeLocal'
V8_INLINE Local(Local<S> that)
^
/Users/kannan/.node-gyp/5.7.0/include/node/v8.h:326:13: note: candidate template ignored: could not match 'S *' against
'v8::MaybeLocal<v8::Object>'
V8_INLINE Local(S* that)
^
In file included from ../binding.cpp:1:
../../nan/nan.h:788:26: error: no member named 'Use' in namespace 'node::Buffer'
return node::Buffer::Use(nan_isolate, data, size);
~~~~~~~~~~~~~~^
../../nan/nan.h:1728:12: error: no member named 'IsExternalAscii' in 'v8::String'; did you mean 'IsExternal'?
if (str->IsExternalAscii()) {
^~~~~~~~~~~~~~~
IsExternal
/Users/kannan/.node-gyp/5.7.0/include/node/v8.h:2171:8: note: 'IsExternal' declared here
bool IsExternal() const;
^
In file included from ../binding.cpp:1:
../../nan/nan.h:1729:23: error: no type named 'ExternalAsciiStringResource' in 'v8::String'; did you mean
'ExternalStringResource'?
const v8::String::ExternalAsciiStringResource* ext;
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
ExternalStringResource
/Users/kannan/.node-gyp/5.7.0/include/node/v8.h:2207:19: note: 'ExternalStringResource' declared here
class V8_EXPORT ExternalStringResource
^
In file included from ../binding.cpp:1:
../../nan/nan.h:1730:16: error: no member named 'GetExternalAsciiStringResource' in 'v8::String'; did you mean
'GetExternalOneByteStringResource'?
ext = str->GetExternalAsciiStringResource();
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GetExternalOneByteStringResource
/Users/kannan/.node-gyp/5.7.0/include/node/v8.h:2274:40: note: 'GetExternalOneByteStringResource' declared here
const ExternalOneByteStringResource* GetExternalOneByteStringResource() const;
^
In file included from ../binding.cpp:1:
../../nan/nan.h:1730:9: error: assigning to 'const v8::String::ExternalStringResource *' from incompatible type 'const
v8::String::ExternalOneByteStringResource *'
ext = str->GetExternalAsciiStringResource();
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../../nan/nan.h:1731:11: error: assigning to 'const char *' from incompatible type 'const uint16_t *'
(aka 'const unsigned short *')
*data = ext->data();
^ ~~~~~~~~~~~
../binding.cpp:124:11: warning: 'FatalException' is deprecated: Use FatalException(isolate, ...) [-Wdeprecated-declarations]
node::FatalException(try_catch);
^
/Users/kannan/.node-gyp/5.7.0/include/node/node.h:283:29: note: 'FatalException' has been explicitly marked deprecated here
inline void FatalException(const v8::TryCatch& try_catch) {
^
/Users/kannan/.node-gyp/5.7.0/include/node/node.h:66:42: note: expanded from macro 'NODE_DEPRECATED'
__attribute__((deprecated(message))) declarator
^
1 warning and 15 errors generated.
make: *** [Release/obj.target/binding/binding.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:100:13)
gyp ERR! stack at ChildProcess.emit (events.js:185:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 14.5.0
gyp ERR! command "/usr/local/Cellar/node/5.7.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/kannan/Develop/gift-website/node_modules/node-sass
gyp ERR! node -v v5.7.0
gyp ERR! node-gyp -v v3.2.1
gyp ERR! not ok
Build failed
I was following the tutorial and had issues on the "npm install" step [1]. I searched around and it looks like the issue is some kind of incompatibility between old versions of "node-sass" and new versions of Node.js. I updated the dependency versions in "package.json" to the latest available (as of today) and "npm install" worked.
Based on the stuff I found online, a bunch of people will probably have this issue. How about updating the package.json to the latest? Mine currently looks like:
[1] The error I got on "npm install"