"Cannot find module 'three' from"

"Cannot find module 'three' from"

我很难将 http://ssrb.github.io/mega-structure/mega-structure.html 的玩具打字应用程序从 typings 迁移到 @types/npm

我想不通的错误是Error: Cannot find module 'three'Error: Cannot find module 'codemirror'

工作流程是typescript/gulp/browserify

对于该迁移,我删除了 typings.json 以及 gulpfilenpm install @types 中的所有打字内容。

然后由于升级类型定义后的一些 API 更改,我修复了一些错误。

我用 import * as THREE from 'three';

替换了 ///<reference path="typings/index.d.ts"/>

它现在无法捆绑,我正在尝试解决但没有成功:

[13:41:56] Using gulpfile mega-structure/gulpfile.js
[13:41:56] Starting 'default'...
[13:41:56] Starting '.bower.install'...
[13:41:58] Using cwd: mega-structure
[13:41:58] Using bower dir: ./bower_components
[13:42:01] Finished '.bower.install' after 4.99 s
[13:42:01] Starting '.peg'...
[13:42:01] Finished '.peg' after 131 ms
[13:42:01] Starting '.examples'...


[13:42:01] Finished '.examples' after 155 ms
[13:42:01] Starting '.ui.release'...
events.js:183
      throw er; // Unhandled 'error' event
      ^

Error: Cannot find module 'three' from 'mega-structure'
    at mega-structure/node_modules/browser-resolve/node_modules/resolve/lib/async.js:46:17
    at process (mega-structure/node_modules/browser-resolve/node_modules/resolve/lib/async.js:173:43)
    at ondir (mega-structure/node_modules/browser-resolve/node_modules/resolve/lib/async.js:188:17)
    at load (mega-structure/node_modules/browser-resolve/node_modules/resolve/lib/async.js:69:43)
    at onex (mega-structure/node_modules/browser-resolve/node_modules/resolve/lib/async.js:92:31)
    at mega-structure/node_modules/browser-resolve/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:152:21)

https://github.com/ssrb/mega-structure/commit/3285f5cb45c110d87ea5db795e47a4a392a15c1f and https://travis-ci.org/ssrb/mega-structure/builds/359637820?utm_source=email&utm_medium=notification

问题是构建正在使用 three.jscodemirror、...的类型声明...与 npm 一起安装,但仍然安装了匹配的 javascript 库使用 bower。 使用 npm 而不是 bower 安装库后,构建恢复了。