baidu_27785259
baidu_27785259
采纳率100%
2019-04-26 10:43 阅读 6.0k

npm run build 时出错

https://github.com/greggman/webgl-fundamentals

在git下载了这个项目,想要在本地运行,结果在执行 npm run build 时出错。请大佬帮忙看一下。

控制台:

Running "buildlessons" task
Warning: requires at least node: 11 Use --force to continue.

Aborted due to warnings.
npm ERR! code ELIFECYCLE
npm ERR! errno 3
npm ERR! webgl-fundamentals@0.0.0 build: `grunt`
npm ERR! Exit status 3
npm ERR!
npm ERR! Failed at the webgl-fundamentals@0.0.0 build 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\56386\AppData\Roaming\npm-cache\_logs\2019-04-26T02_09_33_735Z-debug.log

日志:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'build' ]
2 info using npm@6.4.1
3 info using node@v10.15.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle webgl-fundamentals@0.0.0~prebuild: webgl-fundamentals@0.0.0
6 info lifecycle webgl-fundamentals@0.0.0~build: webgl-fundamentals@0.0.0
7 verbose lifecycle webgl-fundamentals@0.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle webgl-fundamentals@0.0.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\WorkLibo\webgl-fundamentals\node_modules\.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\110\DTS\Binn\;C:\Program Files\TortoiseSVN\bin;C:\Users\56386\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Users\56386\AppData\Local\Microsoft\WindowsApps;;C:\Fiddler;C:\Users\56386\AppData\Local\Microsoft\WindowsApps;C:\Program Files\JetBrains\WebStorm 2019.1\bin;;C:\Users\56386\AppData\Roaming\npm
9 verbose lifecycle webgl-fundamentals@0.0.0~build: CWD: C:\WorkLibo\webgl-fundamentals
10 silly lifecycle webgl-fundamentals@0.0.0~build: Args: [ '/d /s /c', 'grunt' ]
11 silly lifecycle webgl-fundamentals@0.0.0~build: Returned: code: 3  signal: null
12 info lifecycle webgl-fundamentals@0.0.0~build: Failed to exec build script
13 verbose stack Error: webgl-fundamentals@0.0.0 build: `grunt`
13 verbose stack Exit status 3
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack     at EventEmitter.emit (events.js:189:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:189:13)
13 verbose stack     at maybeClose (internal/child_process.js:970:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid webgl-fundamentals@0.0.0
15 verbose cwd C:\WorkLibo\webgl-fundamentals
16 verbose Windows_NT 10.0.17763
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v10.15.3
19 verbose npm  v6.4.1
20 error code ELIFECYCLE
21 error errno 3
22 error webgl-fundamentals@0.0.0 build: `grunt`
22 error Exit status 3
23 error Failed at the webgl-fundamentals@0.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3, true ]


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

2条回答 默认 最新

  • 已采纳
    oZhuXian 铸仙 2019-04-28 11:13

    Running "buildlessons" task
    Warning: requires at least node: 11 Use --force to continue.

    这个文件提示node 版本至少要11,升级node 再来编译

    大致的编译顺序 npm build
    脚本运行时执行package.json,执行里面的scripts 的build, 执行grunt。 grunt 会找 Gruntfile.js 执行.

    webgl-fundamentals\build\js\build.js 中限制版本要>11.

    const requiredNodeVersion = 11;
    if (parseInt((/^v(\d+)./).exec(process.version)[1]) < requiredNodeVersion) {
    throw Error(requires at least node: ${requiredNodeVersion});
    }

    点赞 1 评论 复制链接分享
  • it_lin_web it_lin_web 2019-04-26 11:53

    node npm 装了吗 依赖包装了么 npm i 一下

    点赞 评论 复制链接分享

相关推荐