2016-09-01 40 views
11

此前已工作。但自從我從節點4.6升級到6.5,當我做一個npm start,我結束了以下錯誤節點6.5上的反應本機打包程序失敗

Failed to build DependencyGraph: @providesModule naming collision: 
    Duplicate module name: String.prototype.es6 
    Paths: ...../node_modules/react-native/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js collides with ...../app/MallJell/nd/react-native/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js 

This error is caused by a @providesModule declaration with the same name across two different files. 
Error: @providesModule naming collision: 
    Duplicate module name: String.prototype.es6 
    Paths: ....../react-native/packager/react-packager/src/Resolver/polyfills/String.prototype.es6.js collides with ..../react-packager/src/Resolver/polyfills/String.prototype.es6.js 

This error is caused by a @providesModule declaration with the same name across two different files. 
    at HasteMap._updateHasteMap (..../node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:155:13) 
    at module.getName.then.name (.....node_modules/react-native/packager/react-packager/src/node-haste/DependencyGraph/HasteMap.js:115:31) 
+0

您是否嘗試過更新節點後更新您的node_modules ...? npm install –

+0

您是升級React-Native還是將某些文件從某處複製到最近的React-Native目錄?考慮消息'重複模塊名稱:String.prototypr.es6' – efkan

+0

@AbdulAhad:我完全刪除了我的node_modules,然後運行了'npm install'然後運行'npm start' –

回答

1

我只是把這裏爲你工作,以便其他人可以看到它的答案。

刪除node_modules文件夾

rm -rf node_modules/ 

然後清潔NPM緩存和安裝模塊背面

npm cache clean && npm install 

然後運行打包再次

npm start 
+0

我有完全相同的問題。但上述解決方案對我無效。任何幫助? – amit

+0

運行上述命令後錯誤是否發生變化? –

+0

我有同樣的錯誤。上述步驟沒有任何區別 – amit

-1

我解決了這個問題修改「packag.json」的代碼,然後重新安裝nodemodules。

前:

"scripts": { 
    "start": "node node_modules/react-native/local-cli/cli.js start", 
    "test": "jest" 
}, 


"scripts": { 
     "start": "react-native start" 
}, 
相關問題