开发者问题收集

MDC 101 Material Design Tutorial 在 npm 安装时抛出错误

2020-12-19
1006

当我运行 npm install 时,我收到大量错误(我使用的是 mac Catalina)。

starter npm install

> [email protected] install /Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fsevents
> node install

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-v83-darwin-x64.tar.gz 
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v83 ABI, unknown) (falling back to source compile with node-gyp) 
  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
In file included from ../fsevents.cc:6:
In file included from ../../nan/nan.h:2722:
../../nan/nan_object_wrap.h:24:25: error: no member named 'IsNearDeath' in
      'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
    assert(persistent().IsNearDeath());
           ~~~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/assert.h:93:25: note: 
      expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                        ^
In file included from ../fsevents.cc:6:
In file included from ../../nan/nan.h:2722:
../../nan/nan_object_wrap.h:127:26: error: no member named 'IsNearDeath' in
      'Nan::Persistent<v8::Object, v8::NonCopyablePersistentTraits<v8::Object> >'
    assert(wrap->handle_.IsNearDeath());
           ~~~~~~~~~~~~~ ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/assert.h:93:25: note: 
      expanded from macro 'assert'
    (__builtin_expect(!(e), 0) ? __assert_rtn(__func__, __FILE__, __LINE__, #e) : (void)0)
                        ^
In file included from ../fsevents.cc:6:
In file included from ../../nan/nan.h:2818:
../../nan/nan_typedarray_contents.h:34:43: warning: 'GetContents' is deprecated: Use
      GetBackingStore. See http://crbug.com/v8/9908. [-Wdeprecated-declarations]
      data   = static_cast<char*>(buffer->GetContents().Data()) + byte_offset;
                                          ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:5272:3: note: 
      'GetContents' has been explicitly marked deprecated here
  V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
  ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8config.h:402:39: note: 
      expanded from macro 'V8_DEPRECATE_SOON'
# define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
                                      ^
../fsevents.cc:43:32: error: no template named 'Handle' in namespace 'v8'
    static void Initialize(v8::Handle<v8::Object> exports);
                           ~~~~^
In file included from ../fsevents.cc:73:
../src/constants.cc:89:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagNone").ToLocalChecked()...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:90:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagMustScanSubDirs").ToLoc...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:91:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagUserDropped").ToLocalCh...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:92:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagKernelDropped").ToLocal...
  ~~~~~~~~^~~


                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:93:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagEventIdsWrapped").ToLoc...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^

In file included from ../fsevents.cc:73:
../src/constants.cc:94:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagHistoryDone").ToLocalCh...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:95:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagRootChanged").ToLocalCh...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:96:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagMount").ToLocalChecked(...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:97:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagUnmount").ToLocalChecke...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:98:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagItemCreated").ToLocalCh...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:99:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagItemRemoved").ToLocalCh...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:100:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagItemInodeMetaMod").ToLo...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:101:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagItemRenamed").ToLocalCh...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:102:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagItemModified").ToLocalC...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:103:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagItemFinderInfoMod").ToL...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
In file included from ../fsevents.cc:73:
../src/constants.cc:104:11: error: no matching member function for call to 'Set'
  object->Set(Nan::New<v8::String>("kFSEventStreamEventFlagItemChangeOwner").ToLoc...
  ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make: *** [Release/obj.target/fse/fsevents.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:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 20.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node" "--module_name=fse" "--module_path=/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64" "--napi_version=7" "--node_abi_napi=napi"
gyp ERR! cwd /Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fsevents
gyp ERR! node -v v14.15.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node --module_name=fse --module_path=/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64 --napi_version=7 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1048:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
node-pre-gyp ERR! System Darwin 20.2.0
node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fsevents
node-pre-gyp ERR! node -v v14.15.3
node-pre-gyp ERR! node-pre-gyp -v v0.10.3
node-pre-gyp ERR! not ok 
Failed to execute '/usr/local/bin/node /usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64/fse.node --module_name=fse --module_path=/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fsevents/lib/binding/Release/node-v83-darwin-x64 --napi_version=7 --node_abi_napi=napi' (1)

> [email protected] install /Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fibers
> node build.js || nodejs build.js

  CXX(target) Release/obj.target/fibers/src/fibers.o
../src/fibers.cc:899:12: error: no matching member function for call to 'Set'
                        target->Set(sym_yield, yield);
                        ~~~~~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,
                                    ^
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3673:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided
  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
                                    ^
../src/fibers.cc:903:8: error: no matching member function for call to 'Set'
                        fn->Set(sym_yield, yield);
                        ~~~~^~~
/Users/gayan/Library/Caches/node-gyp/14.15.3/include/node/v8.h:3670:37: note: candidate
      function not viable: requires 3 arguments, but 2 were provided

                                          ^
../src/fibers.cc:206:25: error: no matching member function for call to 'Set'
                info.GetReturnValue().Set(handle);
                ~~~~~~~~~~~~~~~~~~~~~~^~~
../src/fibers.cc:838:17: note: in instantiation of function template specialization
      'uni::Return<v8::Object>' requested here
                                return uni::Return(current->handle, info);

                 ^
5 errors generated.
make: *** [Release/obj.target/fibers/src/fibers.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:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 20.2.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd material-components-web-codelabs-master/mdc-101/starter/node_modules/fibers
gyp ERR! node -v v14.15.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 
node-gyp exited with code: 1
Please make sure you are using a supported platform and node version. If you
would like to compile fibers on this machine please make sure you have setup your
build environment--
Windows + OS X instructions here: https://github.com/nodejs/node-gyp
Ubuntu users please run: `sudo apt-get install g++ build-essential`
RHEL users please run: `yum install gcc-c++` and `yum groupinstall 'Development Tools'` 
Alpine users please run: `sudo apk add python make g++`
sh: nodejs: command not found
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node install`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] install: `node build.js || nodejs build.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!    
➜  starter 

然后我尝试了以下代码

npm i fsevents@latest -f --save-optional

并尝试使用 npm start 启动服务器

然后我遇到以下错误

    ➜  starter npm start

> [email protected] start /Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter
> webpack-dev-server --progress

## There is an issue with `node-fibers` ##
`/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fibers/bin/darwin-x64-83/fibers.node` is missing.

Try running this to fix the issue: /usr/local/bin/node /Users/gayan/Desktop/Web\ Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fibers/build
Error: Cannot find module '/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fibers/bin/darwin-x64-83/fibers'
Require stack:
- /Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fibers/fibers.js
- /Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/webpack.config.js
- /Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/webpack/bin/convert-argv.js
- /Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/webpack-dev-server/bin/webpack-dev-server.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fibers/fibers.js:14:39)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fibers/fibers.js:23
        throw new Error('Missing binary. See message above.');
        ^

Error: Missing binary. See message above.
    at Object.<anonymous> (/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/node_modules/fibers/fibers.js:23:9)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at getStyleUse (/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/webpack.config.js:16:16)
    at Object.<anonymous> (/Users/gayan/Desktop/Web Development/material-components-web-codelabs-master/mdc-101/starter/webpack.config.js:32:14)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `webpack-dev-server --progress`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gayan/.npm/_logs/2020-12-19T14_20_40_046Z-debug.log

然后我尝试了以下

npm uninstall fibers
npm install fibers
npm install

之后我的服务器成功启动

但是我不明白为什么会出现这个错误。

有人能帮助我为什么以下链接中的教程不起作用以及为什么会出现这些错误吗?

提前致谢。

https://codelabs.developers.google.com/codelabs/mdc-101-web#1

3个回答

我遇到了同样的问题 - package-lock.json 中的包版本与我的设置(节点版本等)不匹配,因此在删除 package-lock.json 后,安装顺利进行,没有任何错误,应用程序也开始运行而没有任何错误。

user8244583
2021-04-05

我遇到了类似的问题,但我的错误是

npm ERR! code 127
npm ERR! path /Users/chad/code/material-components-web-codelabs/mdc-101/starter/node_modules/fibers
npm ERR! command failed
npm ERR! command sh -c node build.js || nodejs build.js
npm ERR! CXX(target) Release/obj.target/fibers/src/fibers.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | x64
npm ERR! gyp info find Python using Python version 3.9.6 found at "/usr/local/opt/[email protected]/bin/python3.9"
...
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! ../src/fibers.cc:899:12: error: no matching member function for call to 'Set'
npm ERR!                         target->Set(sym_yield, yield);
npm ERR!                         ~~~~~~~~^~~

我尝试了上面原始海报提到的方法,但仍然有问题。 事实证明,节点 >= 16.0.0 不支持 fiber,如其自述文件 https://github.com/laverdet/node-fibers

Update [April 13th, 2021] -- Fibers is not compatible with nodejs v16.0.0 or later. Unfortunately, v8 commit dacc2fee0f is a breaking change and workarounds are non-trivial.

我最终使用 nvm 将节点版本设置为 14。重新开始安装后,我仍然必须重新安装 fiber:

git clone https://github.com/material-components/material-components-web-codelabs
cd material-components-web-codelabs/mdc-101/starter
npm uninstall fibers
npm install fibers
npm install
npm start

然后 webpack 服务器终于启动了。

Chad
2022-10-30

node-fibers 首页 README 上有一条关于此内容的说明。nodejs v16.x 或更高版本不支持 Fibers。
https://github.com/laverdet/node-fibers/issues/451
https://github.com/laverdet/node-fibers

Aaron
2022-02-09