我的npm有问题。这是我的错误。如果您需要更多信息,请告诉我。我不知道怎么了我搜索有相同问题的人,但找不到相同的错误。还是有关于npm错误的文档?
如果有人能帮助我,那就太好了。
hendrik@xxxs-mac-mini assets % npm install
> sharp@0.23.4 install /Users/hendrik/htdocs/xxx_wp/web/wp-
content/themes/main_xxx/assets/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild
&& node install/dll-copy)
info sharp Using cached /Users/hendrik/.npm/_libvips/libvips-8.8.1-darwin-x64.tar.gz
prebuild-install WARN install No prebuilt binaries found (target=6.9.2 runtime=node arch=x64
libc= platform=darwin)
gyp ERR! UNCAUGHT EXCEPTION
gyp ERR! stack /usr/local/lib/node_modules/npm/node_modules/node-
gyp/node_modules/mkdirp/lib/opts-arg.js:7
gyp ERR! stack opts = { mode: 0o777, fs, ...opts }
gyp ERR! stack ^^^
gyp ERR! stack SyntaxError: Unexpected token ...
gyp ERR! stack at Object.exports.runInThisContext (vm.js:76:16)
gyp ERR! stack at Module._compile (module.js:542:28)
gyp ERR! stack at Object.Module._extensions..js (module.js:579:10)
gyp ERR! stack at Module.load (module.js:487:32)
gyp ERR! stack at tryModuleLoad (module.js:446:12)
gyp ERR! stack at Function.Module._load (module.js:438:3)
gyp ERR! stack at Module.require (module.js:497:17)
gyp ERR! stack at require (internal/module.js:20:19)
gyp ERR! stack at Object.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-
gyp/node_modules/mkdirp/index.js:1:79)
gyp ERR! stack at Module._compile (module.js:570:32)
gyp ERR! System Darwin 19.6.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-
gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/hendrik/htdocs/xxx_wp/web/wp-
content/themes/main_xxx/assets/node_modules/sharp
gyp ERR! node -v v6.9.2
gyp ERR! node-gyp -v v7.1.0
gyp ERR! Node-gyp failed to build your package.
gyp ERR! Try to update npm and/or node-gyp and if it does not help file an issue with the
package author.
xxx@1.0.0 /Users/hendrik/htdocs/xxx_wp/web/wp-content/themes/main_xxx/assets
└── (empty)
npm WARN xxx@1.0.0 No description
npm WARN xxx@1.0.0 No repository field.
npm WARN xxx@1.0.0 No license field.
npm ERR! Darwin 19.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v6.9.2
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! sharp@0.23.4 install: `(node install/libvips && node install/dll-copy && prebuild-
install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the sharp@0.23.4 install script '(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sharp package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sharp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls sharp
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /Users/hendrik/htdocs/xxx_wp/web/wp-content/themes/main_xxx/assets/npm-debug.log
npm ERR! code 1
答案 0 :(得分:1)
所以我回答我自己的问题。我完全卸载了npm和node。我是通过本教程完成的:
要完全卸载node + npm,请执行以下操作:
转到/ usr / local / lib并删除任何节点和node_modules 转到/ usr / local / include并删除任何node和node_modules目录 如果您是通过brew install节点安装的,则在终端中运行brew install节点 检查您的主目录中是否有任何本地或lib或包含文件夹,并从此处删除任何节点或node_modules 转到/ usr / local / bin并删除任何节点可执行文件
比起我用以下代码行安装npm:
npm install -g npm@latest
此npm安装成功后。