如何解决 npm 安装错误“npm ERR!代码1”

2023-12-21

我正在尝试安装Gulp.js https://en.wikipedia.org/wiki/Gulp.js当我写的时候npm install我得到这个问题:

npm ERR! code 1
npm ERR! path D:\www\wegrow\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files (x86)\nodejs\node.exe D:\www\wegrow\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp verb cli [
npm ERR! gyp verb cli   'C:\\Program Files (x86)\\nodejs\\node.exe',
npm ERR! gyp verb cli   'D:\\www\\wegrow\\node_modules\\node-gyp\\bin\\node-gyp.js',
npm ERR! gyp verb cli   'rebuild',
npm ERR! gyp verb cli   '--verbose',
npm ERR! gyp verb cli   '--libsass_ext=',
npm ERR! gyp verb cli   '--libsass_cflags=',
npm ERR! gyp verb cli   '--libsass_ldflags=',
npm ERR! gyp verb cli   '--libsass_library='
npm ERR! gyp verb cli ]
npm ERR! gyp info using [email protected] /cdn-cgi/l/email-protection
npm ERR! gyp info using [email protected] /cdn-cgi/l/email-protection | win32 | ia32
npm ERR! gyp verb command rebuild []
npm ERR! gyp verb command clean []
npm ERR! gyp verb clean removing "build" directory
npm ERR! gyp verb command configure []
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
npm ERR! gyp verb `which` failed Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\www\wegrow\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\www\wegrow\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\www\wegrow\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\www\wegrow\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at D:\www\wegrow\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at D:\www\wegrow\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:194:21)
npm ERR! gyp verb `which` failed  python2 Error: not found: python2
npm ERR! gyp verb `which` failed     at getNotFoundError (D:\www\wegrow\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed     at F (D:\www\wegrow\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed     at E (D:\www\wegrow\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed     at D:\www\wegrow\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed     at D:\www\wegrow\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed     at D:\www\wegrow\node_modules\isexe\windows.js:36:5
npm ERR! gyp verb `which` failed     at FSReqCallback.oncomplete (node:fs:194:21) {
npm ERR! gyp verb `which` failed   code: 'ENOENT'
npm ERR! gyp verb `which` failed }
npm ERR! gyp verb check python checking for Python executable "python" in the PATH
npm ERR! gyp verb `which` succeeded python C:\Python39\python.EXE
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Command failed: C:\Python39\python.EXE -c import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack   File "<string>", line 1
npm ERR! gyp ERR! stack     import sys; print "%s.%s.%s" % sys.version_info[:3];
npm ERR! gyp ERR! stack                       ^
npm ERR! gyp ERR! stack SyntaxError: invalid syntax
npm ERR! gyp ERR! stack
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (node:child_process:326:12)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:365:28)
npm ERR! gyp ERR! stack     at maybeClose (node:internal/child_process:1067:16)
npm ERR! gyp ERR! stack     at Socket.<anonymous> (node:internal/child_process:453:11)
npm ERR! gyp ERR! stack     at Socket.emit (node:events:365:28)
npm ERR! gyp ERR! stack     at Pipe.<anonymous> (node:net:661:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "D:\\www\\wegrow\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\www\wegrow\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.1.0
npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! gyp ERR! not ok
npm ERR! Build failed with error code: 1

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\wbalu\AppData\Local\npm-cache\_logs\2021-05-05T10_38_29_779Z-debug.log

我已经格式化了我的电脑。之前一切正常。现在,当我尝试安装它时,就会弹出这样的信息。我尝试过重新安装 Node.js,但没有帮助。我应该怎么办?


如果您的 Node.js 版本非常新,请尝试降级。稳定版本 14.16.1 有效。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何解决 npm 安装错误“npm ERR!代码1” 的相关文章

随机推荐

  • 网络设备发现

    对于我的 Android 应用程序 用户需要连接到托管在同一 LAN 上某处的服务器 同一 LAN 上可以托管多个服务器 为了方便用户 我打算扫描 Android 设备当前连接的 LAN 然后列出所有运行服务器的网络设备 而不是让用户将 I
  • 发布请求被切断

    我的 javascript 发布请求有问题 我有以下代码用于发送帖子请求 var xhttp new XMLHttpRequest xhttp onreadystatechange function if this readyState 4
  • Spark 和 Cassandra Java 应用程序:线程“主”java.lang.NoClassDefFoundError 中出现异常:org/apache/spark/sql/Dataset

    我得到了一个令人惊奇的 siplme java 应用程序 我几乎从这个例子中复制了它 我想做的就是读取表数据并显示在 Eclipse 控制台中 我的 pom xml
  • 减少 Android 应用程序 (apk) 的大小

    我现在将在 Google Play 商店上发布我的第一个应用程序 我已经压缩了我的应用程序中使用的图像 我对应用程序大小有一些疑问 如果应用程序的大小小于 2 MB 则用户卸载该应用程序的可能性较小 对于属于教育领域的应用程序 我的这种说法
  • 一个 Hive 脚本可以从另一个 Hive 脚本运行吗?

    我创建了两个配置单元脚本 script1 hql 和 script2 hql 是否可以从 script1 hql 运行脚本 script2 hql 我读到了有关使用 source 命令的信息 但无法回避它的使用 任何指针 参考文档将不胜感激
  • 如何使用“Entity Framework Core”(又名 EF7)实现“软删除”?

    我正在尝试使用 EF7 实现 软删除 我的Item表有一个名为IsDeleted类型的bit 我在 SO 和其他地方看到的所有例子都使用这样的东西 protected override void OnModelCreating ModelB
  • PHPExcel 获取相对于给定列的列名

    使用 PHPExcel 是否可以获取位于左侧或右侧 X 列的列的名称 例如 给定列 BZ 我想返回列名称 CB 或 BX 向右或向左 2 个 Thanks PHPExcel 中已经内置了一些函数来帮助您执行此操作 adjustment 2
  • 进行多线程 foreach 循环的最佳方法[关闭]

    Closed 这个问题需要多问focused help closed questions 目前不接受答案 我有一个带有 foreach 的发送电子邮件方法 如下所示 static void Main string args foreach
  • 创建一个可供 Android 中所有 Activity 访问的对象

    我正在尝试创建一个包含对象的数据数组列表 例如地址和属性列表 非常复杂 并且想知道 如何使所有活动都可以访问 和可编辑 一个对象 而不仅仅是它本身实例化于 基本上是这样的 在活动 1 中创建数组 在活动 2 和活动 3 中访问相同的数组 P
  • 以编程方式打开组合框下拉列表[重复]

    这个问题在这里已经有答案了 是否有可能directly以编程方式打开 WindowsForms 组合框 还没有找到这样做的方法或属性 如果没有 有哪些可能的解决方案不涉及大量黑客攻击 Use ComboBox DroppedDown htt
  • Unix/Linux 系统调用是 POSIX 库函数的一部分吗?

    Unix Linux 系统调用全部或大部分是 POSIX 中的吗 许多Linux Unix编程书籍都说POSIX库函数可能是OS系统调用的包装器 也可能不是 例如 http www makelinux net books lkd2 ch05
  • jquery获取矩形宽度和高度传单

    我有一张地图和一个区域选择字段 initialize map var map L map map setView 38 0 2 L tileLayer http s tile cloudmade com 70146506bc514228ad
  • 使用 Python BaseHTTPServer 处理同时/异步请求

    我通过创建一个继承自 HTTPServer 和 ThreadingMixIn 的类来设置一个线程 使用 Python 线程 HTTP 服务器 class ThreadedHTTPServer ThreadingMixIn HTTPServe
  • 获取 Git 分支大小

    我正在尝试跟踪我正在进行的项目的规模 有没有一种简单的方法来获取不同分支的磁盘上的存储库大小 I tried git count objects v 但它为每个分支提供相同的存储库大小 With Git 2 31 Q1 2021 git r
  • 你使用ant的任务吗?

    The ant 任务的文档 http ant apache org manual Tasks depend html states 依赖任务的性能为 取决于许多因素 例如 作为类关系的复杂性和 有多少类文件已过期 关于是否是的决定 重新编译
  • 通过 jQuery 附加 HTML 字符串

    我想使用 jQuery 附加生成以下 HTML 字符串 手动编写代码对我来说看起来太麻烦了 div div
  • Eclipse:Spring bean 和上下文的开放声明/资源

    在观看我的一位同事使用 IntelliJ 工作时 我很嫉妒地注意到他可以在 Java 注释或 Spring 上下文文件中按住 Ctrl Command Click 的 Spring bean 上下文或资源的名称 并且 IntelliJ 将打
  • 在 matplotlib 中使用标量可映射的颜色编码

    is a subplot I created using matplotlib Is it possible to code the colors on the basis of a pre defined range I want to
  • 子进程和父进程ID

    只是与子进程块中的父 pid 值混淆了 我的程序如下 int main int argc char argv pid t pid pid fork if pid 1 perror fork failure exit EXIT FAILURE
  • 如何解决 npm 安装错误“npm ERR!代码1”

    我正在尝试安装Gulp js https en wikipedia org wiki Gulp js当我写的时候npm install我得到这个问题 npm ERR code 1 npm ERR path D www wegrow node