npm 设置strapi项目时无法安装依赖项

mnemlml8  于 2022-12-27  发布在  其他
关注(0)|答案(6)|浏览(277)

npx create-strapi-app my-project --quickstart我正在执行这个命令,它正在尝试使用npm从github下载某些库。由于安全原因,服务器不允许访问github,所以它无法下载像 libvips 这样的库。有没有其他方法来设置strapi项目,以便它可以从任何其他源获得库?以下是错误代码片段

npx: installed 91 in 18.847s
Creating a new Strapi application at /home/centos/my-project.

Creating a quickstart project.
Creating files.
Error while installing dependencies:
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated boom@7.3.0: This module has moved and is now available at @hapi/boom. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated @formatjs/intl-unified-numberformat@3.3.7: We have renamed the package to @formatjs/intl-numberformat
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated hoek@6.1.3: This module has moved and is now available at @hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated mailcomposer@3.12.0: This project is unmaintained
npm WARN deprecated buildmail@3.10.0: This project is unmaintained
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
info sharp Downloading http://10.157.194.58/sharp/v8.10.0/libvips-8.10.0-linux-x64.tar.br
ERR! sharp tunneling socket could not be established, statusCode=403
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
../src/common.cc:24:22: fatal error: vips/vips8: No such file or directory
#include <vips/vips8>
                      ^
compilation terminated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/centos/node-v12.18.4-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 3.10.0-1127.18.2.el7.x86_64
gyp ERR! command "/home/centos/node-v12.18.4-linux-x64/bin/node" "/home/centos/node-v12.18.4-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/centos/my-project/node_modules/sharp
gyp ERR! node -v v12.18.4
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"12.18.4","npm":"6.14.6"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN strapi-connector-bookshelf@3.2.2 requires a peer of knex@^0.20.0 but none is installed. You must install peer dependencies yourself.
npm WARN @buffetjs/utils@3.3.1 requires a peer of yup@^0.27.0 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.5.2 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.26.0 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.26.0 install 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!     /home/centos/.npm/_logs/2020-10-09T11_07_28_305Z-debug.log

Keep trying!

Oh, it seems that you encountered errors while installing dependencies in your project.
Don't give up, your project was created correctly.
Fix the issues mentionned in the installation errors and try to run the following command:

cd /home/centos/my-project && npm install
wfveoks0

wfveoks01#

这对我有帮助。
打开MAC终端并使用以下命令:
1.第一个月

  1. npx create-strapi-app
  2. npm i
  3. npm run develop
pxq42qpu

pxq42qpu2#

我有同样的问题,试试这里:https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md#Solutions
之后,仍然有问题的安装和删除.npm/_libvips/libvips-8.10.0-darwin-x64.tar.br文件,并安装npx create-strapi-app my-project --quickstart一切正常

ut6juiuv

ut6juiuv3#

我有问题,在安装依赖我的操作系统是windows 11测试与节点v14和v16测试与npm v6和v8测试与Yarnnpx和npm没有人工作,我只是卡在线波纹管几个小时

warning "@strapi/strapi > @strapi/admin > webpack-dev-server > http-proxy-middleware@2.0.2" has unmet peer dependency "@types/express@^4.17.13".
warning "@strapi/plugin-users-permissions > grant-koa@5.4.8" has unmet peer dependency "koa@>=2.0.0". 
warning Workspaces can only be enabled in private projects.
[5/5] Building fresh packages...
[-/9] ⠠ waiting...
[-/9] ⠠ waiting...
[-/9] ⠠ waiting...
[4/9] ⠠ sharp
[-/9] ⠐ waiting...
vxbzzdmp

vxbzzdmp4#

对我有效的方法很简单,只需将yarn.lock文件添加到项目的根目录,然后运行yarn install,最后运行yarn start,项目就应该成功启动

hm2xizp9

hm2xizp95#

我知道这个帖子很老了,但我在尝试通过npm使用MySQL数据库在Windows 10本地开发环境中安装Strapi时遇到了同样的问题,尽管这个帖子中发布的一些答案帮助我更好地了解了我的特定情况下的问题,解决方案如下:

在phpMyAdmin中

1.为项目创建新的MySQL DB模式和用户,这将是在npx安装过程中输入的数据库和用户

在Windows PowerShell中(以管理员身份)

  1. npx create-strapi-app@latest my-project
  2. cd my-project
  3. npm install
  4. npm run develop

这些是我用来在本地安装Strapi的npm、node和MySQL版本:

  • npm版本6.14.17使用npm -v检查您的版本
  • node.js版本14.20.0使用node -v检查您的版本
  • MySQL版本10.4.24-玛丽亚数据库

Strapi应在http://localhost:1337/admin处默认运行

  • 要更改端口,需要编辑项目根目录下的.env文件。*
5lhxktic

5lhxktic6#

我也遇到过类似的问题,尝试了很多方法。在终端中运行了这个代码,它解决了我所有的问题:

sudo apt-get install build-essential apt-transport-https lsb-release ca-certificates curl -y

相关问题