我遇到了一个完全难倒我的问题。
我已经开发了一个 Meteor/React 应用程序一周了。我的桌面上一切都运行良好。今天我拿起我的 MacBook,从 Github 上拉取代码并去运行它。
应用程序在 JavaScript 控制台中抛出错误:
modules-runtime.js?hash=637cb12…:139
Uncaught Error: Cannot find module '../../ui/components/signin/Signin.jsx'
at Function.require.resolve (modules-runtime.js?hash=637cb12…:139)
at Module.resolve (modules-runtime.js?hash=637cb12…:91)
at Module.Mp.import (printer.js:170)
at meteorInstall.imports.startup.client.routes.jsx (routes.jsx:1)
at fileEvaluate (modules-runtime.js?hash=637cb12…:191)
at Module.require (modules-runtime.js?hash=637cb12…:116)
at Module.Mp.import (printer.js:170)
at meteorInstall.imports.startup.client.index.js (index.js:1)
at fileEvaluate (modules-runtime.js?hash=637cb12…:191)
at Module.require (modules-runtime.js?hash=637cb12…:116)
我将应用程序克隆到桌面上的一个新文件夹中,在那里我也遇到了同样的问题。我已经删除了对 Signin.jsx 模块的所有引用,但我也收到了针对其他模块抛出的错误。
我不知道是什么原因造成的,该应用程序在我原来的开发目录中运行得很好,但是一旦我将它拉到一个新目录中,我就会在 JS 控制台中收到此错误。
我试过:
meteor reset
meteor npm rebuild
meteor npm install
meteor update
它们都没有产生任何影响。非常感谢您的帮助!
编辑
当我在新目录中运行 meteor npm install
时,出现以下错误,这可能与问题有关吗?
> bcrypt@1.0.2 install /Users/s/Desktop/calendar/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v46-darwin-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for bcrypt@1.0.2 and node@4.6.2 (node-v46 ABI) (falling back to source compile with node-gyp)
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance
CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o
CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o
SOLINK_MODULE(target) Release/bcrypt_lib.node
clang: warning: libstdc++ is deprecated; move to libc++ with a minimum deployment target of OS X 10.9
COPY /Users/s/Desktop/calendar/node_modules/bcrypt/lib/binding/bcrypt_lib.node
TOUCH Release/obj.target/action_after_build.stamp
最佳答案
我已经弄清楚问题出在哪里了。几天前我重命名了一些文件,将它们更改为与它们包含的 React 组件的名称完全相同。
例如 - 我重命名为 signin.jsx -> Signin.jsx
出于某种原因,github 没有注意到一些文件的这种变化,所以当我推送 repo 时,我的一些导入被破坏了。
这就是为什么该应用程序在我的目录中运行良好但在任何克隆目录中运行不正常的原因。
感谢帮助
关于javascript - meteor 错误 : Uncaught Error: Cannot find module 'component.jsx' ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41451774/