ICode9

精准搜索请尝试: 精确搜索
首页 > 编程语言> 文章详细

javascript-yarn无法使用节点12.1.0构建node-sass

2019-11-08 03:34:53  阅读:50  来源: 互联网

标签:yarnpkg node-js javascript



我正在尝试使用yarn install安装我的软件包

我已经安装了节点12.1.0,据我了解,node-sass至少需要为4.12版本才能与节点12一起使用

我的package.json文件是这样的:

{
  "name": "redacted",
  "private": true,
  "dependencies": {
    "@rails/webpacker": "3.5",
    "babel-preset-react": "^6.24.1",
    "bootstrap": "^4.1.2",
    "font-awesome": "^4.7.0",
    "js-md5": "^0.7.3",
    "moment": "^2.22.2",
    "prop-types": "^15.6.2",
    "qrcode.react": "^0.8.0",
    "react": "^16.4.1",
    "react-big-calendar": "^0.19.2",
    "react-dom": "^16.4.1",
    "react-loading": "^2.0.3",
    "react-router": "^4.3.1",
    "react-router-dom": "^4.3.1",
    "react-transition-group": "^2.5.0",
    "urijs": "^1.19.1"
  },
  "devDependencies": {
    "webpack-dev-server": "2.11.2"
  }
}

我得到的(截断)错误是:

../fsevents.cc:85:58: error: expected ';' after top level declarator
void FSEvents::Initialize(v8::Handle<v8::Object> exports) {
                                                         ^
                                                         ;
30 warnings and 14 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 (/Users/snowflakekiller/Documents/Projects/Code/sjc_platform/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:256:12)
gyp ERR! System Darwin 18.2.0
gyp ERR! command \"/usr/local/Cellar/node/12.1.0/bin/node\" \"/Users/snowflakekiller/Documents/Projects/Code/sjc_platform/node_modules/node-gyp/bin/node-gyp.js\" \"build\" \"--fallback-to-build\" \"--module=/Users/snowflakekiller/Documents/Projects/Code/sjc_platform/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node\" \"--module_name=fse\" \"--module_path=/Users/snowflakekiller/Documents/Projects/Code/sjc_platform/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64\" \"--napi_version=4\" \"--node_abi_napi=napi\"
gyp ERR! cwd /Users/snowflakekiller/Documents/Projects/Code/sjc_platform/node_modules/fsevents
gyp ERR! node -v v12.1.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/local/Cellar/node/12.1.0/bin/node /Users/snowflakekiller/Documents/Projects/Code/sjc_platform/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/snowflakekiller/Documents/Projects/Code/sjc_platform/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64/fse.node --module_name=fse --module_path=/Users/snowflakekiller/Documents/Projects/Code/sjc_platform/node_modules/fsevents/lib/binding/Release/node-v72-darwin-x64 --napi_version=4 --node_abi_napi=napi' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/snowflakekiller/Documents/Projects/Code/sjc_platform/node_modules/fsevents/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:196:13)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1000:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
node-pre-gyp ERR! System Darwin 18.2.0
node-pre-gyp ERR! command \"/usr/local/Cellar/node/12.1.0/bin/node\" \"/Users/snowflakekiller/Documents/Projects/Code/sjc_platform/node_modules/fsevents/node_modules/node-pre-gyp/bin/node-pre-gyp\" \"install\" \"--fallback-to-build\"
node-pre-gyp ERR! cwd /Users/snowflakekiller/Documents/Projects/Code/sjc_platform/node_modules/fsevents
node-pre-gyp ERR! node -v v12.1.0
node-pre-gyp ERR! node-pre-gyp -v v0.10.0
node-pre-gyp ERR! not ok

我试过仅单独安装node-sass和yarn add node-sass,但是它仍然会因相同的错误而失败.

我该如何克服?

解决方法:

我设法通过删除锁定文件并再次运行yarn install来解决此问题.



标签:yarnpkg,node-js,javascript
来源: https://codeday.me/bug/20191108/2005364.html

专注分享技术,共同学习,共同进步。侵权联系[admin#icode9.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有