daw*_*awn 32 windows node.js npm npm-install
我尝试使用 npm 5.6.0 在 Windows 10 上安装模块。当我输入 npm install 时,我得到:
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (C:\Users\xiaooming\Desktop\app\node_modules\node-gyp\lib\configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "D:\\Program Files\\nodejs\\node.exe" "C:\\Users\\xiaooming\\Desktop\\app\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\xiaooming\Desktop\app\node_modules\node-sass
gyp ERR! node -v v8.10.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN kingt4.0app@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.13.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xiaooming\AppData\Roaming\npm-cache\_logs\2018-03-18T13_02_03_946Z-debug.log
Run Code Online (Sandbox Code Playgroud)
看起来像 node-sass 安装错误。环境如下:
蟒蛇版本:2.7.14
npm 版本:5.6.0
节点版本:8.10.0
ruby 版本:2.3.3p222 (2016-11-21 修订版 56859) [i386-mingw32]
系统:win10(x64)
节点gyp:3.6.2
并且我已经安装了 Microsoft Visual Studio express 2015,下面的命令是否已执行?
npm config set msvs_version 2015
node-gyp configure --msvs_version=2015
npm install --global --production windows-build-tools
Run Code Online (Sandbox Code Playgroud)
package.json 是:
{
"name": "kingt4.0app",
"version": "1.0.0",
"description": "an kingt4.0 project.",
"main": "index.js",
"scripts": {
"test": "test.js"
},
"keywords": [
"finance"
],
"author": "kingdom",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.11.1",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^3.1.0",
"gulp-cache": "^0.4.2",
"gulp-changed": "^1.3.2",
"gulp-clean-css": "^2.0.2",
"gulp-file-include": "^0.13.7",
"gulp-if": "^2.0.0",
"gulp-imagemin": "^2.4.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.2.0",
"gulp-sourcemaps": "^1.6.0",
"gulp.spritesmith": "^6.2.1",
"imagemin-jpegtran": "^4.3.2",
"imagemin-pngquant": "^4.2.2",
"merge-stream": "^1.0.0",
"normalize.css": "^4.0.0",
"spritesheet-templates": "^10.1.2",
"vinyl-buffer": "^1.0.0"
},
"dependencies": {
"remodal": "^1.0.7",
"slick-carousel": "^1.6.0"
}
}
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题?感谢帮助。
use*_*650 69
如果这是一台 mac 机器 (OSX),你可以这样做
使用终端
xcode-select --print-path
Run Code Online (Sandbox Code Playgroud)
然后删除已安装的版本
sudo rm -r -f /Library/Developer/CommandLineTools
Run Code Online (Sandbox Code Playgroud)
并重新安装
xcode-select --install
Run Code Online (Sandbox Code Playgroud)
这应该可以解决问题
参考:gyp:未检测到 Xcode 或 CLT 版本 macOS Catalina
Azl*_*mal 26
这对我有用。下面一一运行命令
rm -rf node_modules
rm package-lock.json
npm update
npm install
Run Code Online (Sandbox Code Playgroud)
小智 23
$ npm i --ignore-script
Run Code Online (Sandbox Code Playgroud)
我尝试了不同的方法来解决这个问题,最后,这个评论只是帮助安装节点包没有任何错误。
小智 16
此错误是由于过时的软件包造成的。它还可能是由于 NodeJS、npm 或其他包和/或包管理器的版本更改所致。要解决这个问题,您必须删除node_modules并执行命令:
npm i --ignore-script
Run Code Online (Sandbox Code Playgroud)
可能会node-sass出现错误,因为它已经过时,因此请安装 npm sass。如果是另一个软件包,只需检查当前版本并更新即可。
试试下面的这个命令,看看是否消除了这个问题。我的 mac 上有 catalina,这个命令解决了这个问题。
npm i -g node-gyp@latest && npm config set node_gyp "/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
64082 次 |
| 最近记录: |