微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

使用 yarn install

如何解决使用 yarn install

试图让一个基于 Ruby 的项目在本地运行,但我在运行 node-sass: command Failed 时遇到了一个问题(或几个)yarn install。之后它走下坡路。 我已经安装了 Node、Ruby、Rails 等,但我找不到解决方案。我尝试通过 npm 安装 node-sass 然后再次运行 yarn install 以安装其他依赖项,但我得到了相同的结果...

我在下面收到此错误

error /home/fernie/theodinproject/node_modules/node-sass: Command Failed.
Exit code: 1
Command: node scripts/build.js
Arguments: 
Directory: /home/fernie/theodinproject/node_modules/node-sass
Output:
Building: /home/fernie/.nvm/versions/node/v15.14.0/bin/node /home/fernie/theodinproject/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   '/home/fernie/.nvm/versions/node/v15.14.0/bin/node',gyp verb cli   '/home/fernie/theodinproject/node_modules/node-gyp/bin/node-gyp.js',gyp verb cli   'rebuild',gyp verb cli   '--verbose',gyp verb cli   '--libsass_ext=',gyp verb cli   '--libsass_cflags=',gyp verb cli   '--libsass_ldflags=',gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@15.14.0 | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` Failed Error: not found: python2
gyp verb `which` Failed     at getNotFoundError (/home/fernie/theodinproject/node_modules/which/which.js:13:12)
gyp verb `which` Failed     at F (/home/fernie/theodinproject/node_modules/which/which.js:68:19)
gyp verb `which` Failed     at E (/home/fernie/theodinproject/node_modules/which/which.js:80:29)
gyp verb `which` Failed     at /home/fernie/theodinproject/node_modules/which/which.js:89:16
gyp verb `which` Failed     at /home/fernie/theodinproject/node_modules/isexe/index.js:42:5
gyp verb `which` Failed     at /home/fernie/theodinproject/node_modules/isexe/mode.js:8:5
gyp verb `which` Failed     at FSReqCallback.oncomplete (node:fs:193:21)
gyp verb `which` Failed  python2 Error: not found: python2
gyp verb `which` Failed     at getNotFoundError (/home/fernie/theodinproject/node_modules/which/which.js:13:12)
gyp verb `which` Failed     at F (/home/fernie/theodinproject/node_modules/which/which.js:68:19)
gyp verb `which` Failed     at E (/home/fernie/theodinproject/node_modules/which/which.js:80:29)
gyp verb `which` Failed     at /home/fernie/theodinproject/node_modules/which/which.js:89:16
gyp verb `which` Failed     at /home/fernie/theodinproject/node_modules/isexe/index.js:42:5
gyp verb `which` Failed     at /home/fernie/theodinproject/node_modules/isexe/mode.js:8:5
gyp verb `which` Failed     at FSReqCallback.oncomplete (node:fs:193:21) {
gyp verb `which` Failed   code: 'ENOENT'
gyp verb `which` Failed }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python /usr/bin/python
gyp ERR! configure error 
gyp ERR! stack Error: Command Failed: /usr/bin/python -c import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack   File "<string>",line 1
gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
gyp ERR! stack                       ^
gyp ERR! stack SyntaxError: invalid Syntax
gyp ERR! stack 
gyp ERR! stack     at ChildProcess.exithandler (node:child_process:326:12)
gyp ERR! stack     at ChildProcess.emit (node:events:369:20)
gyp ERR! stack     at maybeClose (node:internal/child_process:1067:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
gyp ERR! System Linux 5.8.0-50-generic
gyp ERR! command "/home/fernie/.nvm/versions/node/v15.14.0/bin/node" "/home/fernie/theodinproject/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/fernie/theodinproject/node_modules/node-sass
gyp ERR! node -v v15.14.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 

package.json

{
  "license": "MIT","scripts": {
    "test": "jest --coverage","eslint": "eslint --max-warnings 0 './app/javascript/**/*'"
  },"dependencies": {
    "@babel/preset-react": "^7.13.13","@hookform/resolvers": "^0.1.1","@rails/ujs": "^6.1.3","@rails/webpacker": "5.2.1","@sentry/browser": "^6.2.5","axios": "^0.21.1","babel-plugin-prismjs": "^2.0.1","babel-plugin-transform-react-remove-prop-types": "^0.4.24","bootstrap": "^4.5.3","core-js": "^3.10.1","hint.css": "^2.6.0","jquery": "^3.6.0","js-base64": "^3.6.0","node-sass": "^4.14.1","popper.js": "^1.16.1","prismjs": "^1.23.0","prop-types": "^15.7.2","react": "^16.14.0","react_ujs": "^2.6.1","react-dom": "^16.14.0","react-flip-move": "^3.0.4","react-hook-form": "^6.15.1","react-scrolllock": "^5.0.1","react-tabs": "^3.2.2","regenerator-runtime": "^0.13.7","stickyfilljs": "^2.1.0","toaster": "^0.1.2","turbolinks": "^5.2.0","validate.js": "^0.13.1","yup": "^0.32.9"
  },"devDependencies": {
    "@testing-library/jest-dom": "^5.11.10","@testing-library/react": "^11.2.6","eslint": "^7.24.0","eslint-config-airbnb": "^18.2.1","eslint-plugin-import": "^2.22.1","eslint-plugin-jsx-a11y": "^6.4.1","eslint-plugin-react": "^7.23.2","eslint-plugin-react-hooks": "^4.2.0","jest": "^26.6.3","webpack-dev-server": "^3.11.2"
  },"jest": {
    "clearMocks": true,"testPathIgnorePatterns": [
      "<rootDir>/config/","/node_modules/","/vendor/"
    ],"setupFilesAfterEnv": [
      "<rootDir>/setupTests.js"
    ]
  }
}

似乎 node-sass一个 webpacker 依赖项,对吗?因为这是在 yarn 运行 @rails/webpacker 之后发生的。

我认为一切都是最新的

$ node -v
v15.14.0
$ node-sass -v
node-sass    5.0.0    (Wrapper)    [JavaScript]
libsass      3.5.5    (Sass Compiler)    [C/C++]
$ yarn -v
1.22.10
$ ruby -v
ruby 2.6.6p146 (2020-03-31 revision 67876) [x86_64-linux]
$ rails -v
Rails 6.1.3.1
$ node-gyp -v
v8.0.0

有没有人知道是什么导致了这种情况?

这是我第一次为 Ruby 项目做出贡献,我不想搞砸。我感谢任何帮助

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。