首页 > 解决方案 > 无法解决我的 npm install 问题

问题描述

我的 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

标签: npm

解决方案


所以我回答我自己的问题。我完全卸载了 npm 和 node。我用本教程完成了它:

要完全卸载 node + npm 是执行以下操作:

转到 /usr/local/lib 并删除任何节点和 node_modules 转到 /usr/local/include 并删除任何节点和 node_modules 目录如果您使用 brew install node 安装,然后在终端中运行 brew uninstall node 检查您的主目录任何本地或 lib 或包含文件夹,并从那里删除任何节点或 node_modules 转到 /usr/local/bin 并删除任何节点可执行文件

比我用这行代码安装 npm :

npm install -g npm@latest

在这个 npm install 工作之后。


推荐阅读