2017-01-03 134 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期間。

相關問題