运行 npm install 给我这些错误
running npm install gives me these errors
I have tried a lot of things in order to fix this but can t find a solution, installed node sass that just added more problems, it used to run without a problem now I keep getting errors
npm ERR! code 1
npm ERR! path D:\sb-app\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\nodejs\node.exe D:\sb-app\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\nodejs\node.exe',
npm ERR! gyp verb cli 'D:\sb-app\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 node-gyp@3.8.0
npm ERR! gyp info using node@16.2.0 | win32 | x64
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:\sb-app\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\sb-app\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\sb-app\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\sb-app\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:\sb-app\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\sb-app\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\sb-app\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\sb-app\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 Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\sb-app\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\sb-app\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.2.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\Ionutz\AppData\Local\npm-cache\_logs21-05-21T08_51_40_333Z-debug.log
我不知道该怎么做我也尝试安装 node-sass 但没有成功
npm 错误有时会非常(可以说是过于)冗长。错误的有趣部分是:
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
您尝试安装的包有一个使用 gyp 在本地编译的本机部分,作为其工具的一部分,npm 需要 python2 来执行构建。
您需要确保已安装 python2,并且可执行文件是路径的一部分。
或者,如果您安装了 python 但名称不同,您可以通过调用
告诉 npm 使用哪个可执行文件
npm config set python /path/to/your/python
我昨天遇到了类似的问题。我通过确保在默认目录中下载 python 并安装 Windows Build Tools 来修复它,因为 node-sass 需要 node-gyp 而在 return 中需要 Windows 构建工具。
您可以使用管理员 shell 下载它,但转到此 page, then find and download 'Build Tools for Visual Studio'. A good video explaining the process can also be found here. As mentioned before, you can install with powershell providing it is run as admin, this process can be found on it's npm page here.
同样容易
删除节点模块文件夹并在完成后重新运行 npm install 可能是值得的。
我遇到了类似的问题。尝试删除 package-lock.json 然后重新运行 'npm install'.
I have tried a lot of things in order to fix this but can t find a solution, installed node sass that just added more problems, it used to run without a problem now I keep getting errors
npm ERR! code 1
npm ERR! path D:\sb-app\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\nodejs\node.exe D:\sb-app\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\nodejs\node.exe',
npm ERR! gyp verb cli 'D:\sb-app\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 node-gyp@3.8.0
npm ERR! gyp info using node@16.2.0 | win32 | x64
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:\sb-app\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\sb-app\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\sb-app\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\sb-app\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:\sb-app\node_modules\which\which.js:13:12)
npm ERR! gyp verb `which` failed at F (D:\sb-app\node_modules\which\which.js:68:19)
npm ERR! gyp verb `which` failed at E (D:\sb-app\node_modules\which\which.js:80:29)
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\which\which.js:89:16
npm ERR! gyp verb `which` failed at D:\sb-app\node_modules\isexe\index.js:42:5
npm ERR! gyp verb `which` failed at D:\sb-app\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 Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "D:\sb-app\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
npm ERR! gyp ERR! cwd D:\sb-app\node_modules\node-sass
npm ERR! gyp ERR! node -v v16.2.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\Ionutz\AppData\Local\npm-cache\_logs21-05-21T08_51_40_333Z-debug.log
我不知道该怎么做我也尝试安装 node-sass 但没有成功
npm 错误有时会非常(可以说是过于)冗长。错误的有趣部分是:
npm ERR! gyp verb check python checking for Python executable "python2" in the PATH
您尝试安装的包有一个使用 gyp 在本地编译的本机部分,作为其工具的一部分,npm 需要 python2 来执行构建。
您需要确保已安装 python2,并且可执行文件是路径的一部分。
或者,如果您安装了 python 但名称不同,您可以通过调用
告诉 npm 使用哪个可执行文件npm config set python /path/to/your/python
我昨天遇到了类似的问题。我通过确保在默认目录中下载 python 并安装 Windows Build Tools 来修复它,因为 node-sass 需要 node-gyp 而在 return 中需要 Windows 构建工具。
您可以使用管理员 shell 下载它,但转到此 page, then find and download 'Build Tools for Visual Studio'. A good video explaining the process can also be found here. As mentioned before, you can install with powershell providing it is run as admin, this process can be found on it's npm page here.
同样容易删除节点模块文件夹并在完成后重新运行 npm install 可能是值得的。
我遇到了类似的问题。尝试删除 package-lock.json 然后重新运行 'npm install'.