foundation new 命令失败,提示 npm Node 模块未安装

问题描述 投票:0回答:3

我对基本上所有事情都很陌生,抱歉。按照 https://foundation.zurb.com/sites/docs/installation.html 上的说明,我已使用 NPM 在全局安装了 Foundation CLI。

以下是我对所有内容的版本:

  • NodeJS:10.0.0
  • npm:6.0.0
  • 基础 CLI:2.2.5

运行

foundation new
,我选择一个网站项目,输入其名称,然后选择基本模板。

该命令费尽心思,但最终得出:

There were some problems during the installation.

 ✓ New project folder created.
 ✗ Node modules not installed. Try running npm install manually.
 ✓ Bower components installed.

在此输出之前,有一些看起来相关的内容:

make: Entering directory '/home/testproject/testproject/node_modules/gulp-sass/node_modules/node-sass/build'
  g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DLIBSASS_VERSION="3.3.6"' -I/home/testproject/.node-gyp/10.0.0/include/node -I/home/testproject/.node-gyp/10.0.0/src -I/home/testproject/.node-gyp/10.0.0/deps/uv/include -I/home/testproject/.node-gyp/10.0.0/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++1y -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
src/libsass.target.mk:139: recipe for target 'Release/obj.target/libsass/src/libsass/src/ast.o' failed
make: *** [Release/obj.target/libsass/src/libsass/src/ast.o] Error 4
make: Leaving directory '/home/testproject/testproject/node_modules/gulp-sass/node_modules/node-sass/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/testproject/testproject/node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Linux 4.4.0-1055-aws
gyp ERR! command "/usr/bin/node" "/home/testproject/testproject/node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/testproject/testproject/node_modules/gulp-sass/node_modules/node-sass
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1

我按照说明尝试在项目目录中手动运行

npm install
。这会产生大量输出,导致终端的历史缓冲区爆满。但一切都以:

gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/testproject/testproject/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Linux 4.4.0-1055-aws
gyp ERR! command "/usr/bin/node" "/home/testproject/testproject/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /home/testproject/testproject/node_modules/node-sass
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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!     /home/testproject/.npm/_logs/2018-05-04T01_51_12_745Z-debug.log

所以看起来同样的问题正在发生。最后一行提到的日志文件有10459行长,所以我把它放在gist.github.com上:https://gist.github.com/MadEmperorYuri/b128b3cd62fc77daa25c1a9dcd5c743b

我不知道该怎么办。谢谢!

npm zurb-foundation
3个回答
1
投票

你可以在这里看到https://github.com/foundation/foundation-sites/issues/11755

使用命令 npx -p node@10 基金会新 --framework 电子邮件


0
投票

问题是 Foundation 默认使用 [email protected],这取决于 [email protected]。 Npm 将此依赖项解析为 [email protected],它与 Node v8 及更高版本不兼容。

你必须使用最新版本的 gulp-sass。可以简单地通过以下步骤完成:

  • 删除
    node_modules/
    文件夹
  • 删除
    package-lock.json
    文件
  • 删除
    "gulp-sass": "^2.1.0"
    中的
    package.json
  • 奔跑
    npm i gulp-sass --save-dev

-2
投票

根据此 Stack Overflow 帖子,错误“npm node 模块未安装”是由正在使用的 Node-sass 版本与 Node.js 版本之间不兼容引起的 [1]。

以下是修复错误的步骤:

删除node_modules文件夹。 删除 package-lock.json 文件。 删除 package.json 文件中的 "gulp-sass": "^2.1.0" 行。 运行命令 npm i gulp-sass --save-dev。 这会将 gulp-sass 更新为与您的 Node.js 版本兼容的版本。

如果您还有其他问题,请告诉我! 拉斯维加斯基金会

© www.soinside.com 2019 - 2024. All rights reserved.