2017-01-03 135 views
2

我有一个问题,绝对难倒我。流星错误:未捕获错误:无法找到模块'component.jsx'

我有一个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

> [email protected] 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 [email protected] and [email protected] (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 
+1

你确定套管是否正确? ''../../ui/components/signin/Signin.jsx'doublecheck你的import/require语句使用确切的大写字母作为实际文件。你也可以在你导入该组件的地方发布一段代码吗? – azium

+0

是的,外壳是完美的。该应用程序完全在我正在开发的原始目录中工作,只有当我将它克隆到一个新的目录中时,它才会中断(这让我认为问题与node_modules文件夹有关,因为它不会推送到github上。 检查我的编辑! – Sean

+1

在运行npm install之前,请删除.meteor文件夹中的本地文件夹。 –

回答

0

我已经知道问题出在哪里。前几天我重命名了一些文件,将它们改为与它们包含的React组件的名称完全相同。

因此,举例来说 - 我改名signin.jsx - > Signin.jsx

出于某种原因,github上没有注意到的几个文件,这种变化,所以当我推开回购,我的一些进口的被打破。

这就是为什么应用程序在我的目录中完美工作,而不是在任何克隆目录中。

感谢您的帮助

0

流星的运行实例每次创建的文件夹是

./meteor/Local

请删除此文件夹。

如果您更改项目目录,请不要打开此文件夹。如果使用git,在创建gitignore文件的时候启动git。在git push Local Folder Removed期间。

相关问题