node.js - 如何开始使用 yeoman 和 Three.js?

标签 node.js three.js gruntjs yeoman bower

我使用 bower install Threejs 安装了 Three.js。

然后,我希望在我的页面中包含 Three.js,因此我的 app.js 文件以以下内容开头:

define(["jquery", "three"], function() {
  "use strict";

但是,当我的页面加载时,Chrome 控制台显示:

Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:9000/scripts/three.js
Uncaught Error: Script error

那么,它不应该像 jQuery 一样查找组件吗?

基本上,我如何开始使用 yeoman 并安装 Three.js?

最佳答案

解决方法如下。

app.js 文件需要引用上面的“三”,这指的是具有以下内容的文件 main.js。

require.config({
    paths: {
        jquery: '../components/jquery/jquery',
        three: '../components/threejs/build/three'
    },
    shim: {
        bootstrap: {
            deps: ['jquery'],
            exports: 'jquery'
        }
    }
});

这里的关键是三个,它指向 Threejs Three.js 文件所在的位置。

关于node.js - 如何开始使用 yeoman 和 Three.js?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15595640/

相关文章:

node.js - zsh:找不到命令:grunt-init

mysql - ER_ACCESS_DENIED_ERROR : Access denied for user '' @'localhost' (using password: NO)

javascript - 使用 Node.js 将许多记录插入 Mongodb 的正确方法

javascript - Neo4j 仅当 where 子句始终为真时才返回 Node

reactjs - 如何在下一个 js 中从节点模块外部的文件夹中导入模块

javascript - 如何在 three.js 中将 MTL 纹理添加到 OBJ

node.js - 您应该使用 Babel 配置中的 `env` 部分在生产中禁用 react-transform-hmr

javascript - 如何从 Three.js 中的文件中最好地导出/导入 THREE.Vector3 数组?

node.js - 在 Windows 上运行 ubuntu 上的 bash 运行 npm 命令给出错误 "/usr/bin/env: node: No such file or directory"

javascript - Grunt 在端口 8000 上运行,我不知道为什么