无法使用节点12.0.0-pre和npm 6.6.0 OSX安装Webpack

时间:2019-01-21 15:48:15

标签: webpack node-gyp fsevents

所以我运行命令npm install -D webpack

node-pre-gyp WARN Using needle for node-pre-gyp https download 
node-pre-gyp WARN Tried to download(404): https://fsevents-binaries.s3-us-west-2.amazonaws.com/v1.2.7/fse-v1.2.7-node-v68-darwin-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for fsevents@1.2.7 and node@12.0.0-pre (node-v68 ABI, unknown) (falling back to source compile with node-gyp) 

...

../../nan/nan_implementation_12_inl.h:356:58: error: expected '(' for function-style cast or type construction
  return v8::StringObject::New(value).As<v8::StringObject>();
                                         ~~~~~~~~~~~~~~~~^
../../nan/nan_implementation_12_inl.h:356:60: error: expected expression
  return v8::StringObject::New(value).As<v8::StringObject>();
                                                           ^
../fsevents.cc:43:32: error: no template named 'Handle' in namespace 'v8'
    static void Initialize(v8::Handle<v8::Object> exports);
                           ~~~~^

...

../fsevents.cc:76:16: error: variable has incomplete type 'void'
void FSEvents::Initialize(v8::Handle<v8::Object> exports) {
               ^
../fsevents.cc:76:31: error: no member named 'Handle' in namespace 'v8'
void FSEvents::Initialize(v8::Handle<v8::Object> exports) {
                          ~~~~^
../fsevents.cc:76:48: error: expected '(' for function-style cast or type construction
void FSEvents::Initialize(v8::Handle<v8::Object> exports) {
                                     ~~~~~~~~~~^
../fsevents.cc:76:50: error: use of undeclared identifier 'exports'
void FSEvents::Initialize(v8::Handle<v8::Object> exports) {
                                                 ^
../fsevents.cc:76:58: error: expected ';' after top level declarator
void FSEvents::Initialize(v8::Handle<v8::Object> exports) {
                                                         ^
                                                         ;
22 warnings and 9 errors generated.
make: *** [Release/obj.target/fse/fsevents.o] Error 1

前几天没有发生这种情况,所以我不确定是什么原因造成的。我尝试了npm cache clean -f等,但似乎无济于事。

1 个答案:

答案 0 :(得分:0)

今天我自己遇到了这个问题,请先删除package.lock.jsonnode_modules,然后再运行npm install来解决。