1
我有開始NPM問題(ReactJS)錯誤NPM開始ReactJS
當我運行終端npm start
這是顯示錯誤:
ERROR in multi (webpack)-dev-server/client? http://localhost:8080 webpack/hot/dev-server /index.js Module not found: Error: Can't resolve '/index.js' in '/home/truc/TrucTran/dev/workspace/reactapp' @ multi (webpack)-dev-server/client? http://localhost:8080 webpack/hot/dev-server /index.js webpack: Failed to compile.
內容文件的package.json:
{
"name": "reactapp",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --hot"
},
"author": "",
"license": "ISC",
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2"
}
}
個內容文件webpack.package.js:
var config = {
entry: '/index.js',
output: {
path:'/home/truc/TrucTran/dev/workspace/reactapp/',
filename: 'index.js',
},
devServer: {
inline: true,
port: 8080
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}
]
}
}
module.exports = config;
請幫我這個問題!
感謝
文件index.js已經在我的目錄中 –
嗯,這就是我可以告訴你的全部內容,因爲這實際上是錯誤說的,我沒有足夠的信息來真正跳到其他結論。我建議再次檢查你的'index'文件所在的位置,或者再次檢查你的配置。 – stinodes
非常感謝stinodes :)我會審查整個項目 –