node.js - 纱线安装失败导入系统;打印 "%s.%s.%s" % sys.version_info[:3] 无效语法
问题描述
执行此操作时yarn install
出现此错误,但其他项目也没有问题,也使用 Brew 安装节点。注意确定我还应该尝试什么,有什么建议吗?
error */node_modules/node-sass: Command failed.
Exit code: 1
Command: node scripts/build.js
Arguments:
Directory: */node_modules/node-sass
Output:
Building: /opt/homebrew/Cellar/node@14/14.18.1/bin/node */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 '/opt/homebrew/Cellar/node@14/14.18.1/bin/node',
gyp verb cli '*/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@14.18.1 | darwin | arm64
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 "/opt/homebrew/opt/python@3.9/bin/python3" in the PATH
gyp verb `which` succeeded /opt/homebrew/opt/python@3.9/bin/python3 /opt/homebrew/opt/python@3.9/bin/python3
gyp ERR! configure error
gyp ERR! stack Error: Command failed: /opt/homebrew/opt/python@3.9/bin/python3 -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 (child_process.js:383:12)
gyp ERR! stack at ChildProcess.emit (events.js:400:28)
gyp ERR! stack at maybeClose (internal/child_process.js:1058:16)
gyp ERR! stack at Socket.<anonymous> (internal/child_process.js:443:11)
gyp ERR! stack at Socket.emit (events.js:400:28)
gyp ERR! stack at Pipe.<anonymous> (net.js:686:12)
gyp ERR! System Darwin 21.1.0
gyp ERR! command "/opt/homebrew/Cellar/node@14/14.18.1/bin/node" "*/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd */node_modules/node-sass
gyp ERR! node -v v14.18.1
- MacBook Pro M1 Max
- 节点 v16.13.0
- 下午 6.14.15
解决方案
通过升级 node-sass 版本修复
推荐阅读
- php - MySQL 中的外键约束形成错误:Laravel 迁移
- multithreading - 在 std::lock_guard<> 的声明中添加 const 有什么意义?
- node.js - React 代理使用了错误的 url
- php - 如何检查PHP中的所有参数是否为假?
- r - 在R中将负值转换为零
- powershell - Microsoft 文档给出的 Set-MalwareFilterPolicy 示例失败
- java - 如何获得肥皂身体
- java - 使用 Tomcat 运行带有外部库的应用程序时出现 NoClassDefFoundError
- sql - Amazon Redshift 中的动态合并语句 (upsert)
- scala - 将 Spark Dataframe 列转换为行