Javascript “如何解决错误”;未找到输入模块中的错误:错误:无法解析';文件';或';目录'&引用;你有什么反应?

Javascript “如何解决错误”;未找到输入模块中的错误:错误:无法解析';文件';或';目录'&引用;你有什么反应?,javascript,reactjs,Javascript,Reactjs,我是reactjs新手,正在尝试开发简单的应用程序。我正在关注youtube视频以开发基本应用程序 我采用了同样的方法,但我正在windows中开发我的应用程序。当我运行npm start时,出现以下错误 ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' C:\Users\manoos\my_prj\reactjs-basics\srcap p/index.js in C:\Users\man

我是reactjs新手,正在尝试开发简单的应用程序。我正在关注youtube视频以开发基本应用程序

我采用了同样的方法,但我正在windows中开发我的应用程序。当我运行
npm start
时,出现以下错误

ERROR in Entry module not found: Error: Cannot resolve 'file' or 'directory' C:\Users\manoos\my_prj\reactjs-basics\srcap
p/index.js in C:\Users\manoos\my_prj\reactjs-basics
The syntax of the command is incorrect.

npm ERR! Windows_NT 6.1.7600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\manoos\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\n
pm-cli.js" "run" "build"
npm ERR! node v5.6.0
npm ERR! npm  v3.10.7
npm ERR! code ELIFECYCLE
npm ERR! reactjs-basics@1.0.0 build: `webpack -d && copy src/index.html dist/index.html && webpack-dev-server --content-
base src/ --inline --hot`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactjs-basics@1.0.0 build script 'webpack -d && copy src/index.html dist/index.html && webpack-d
ev-server --content-base src/ --inline --hot'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the reactjs-basics package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack -d && copy src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs reactjs-basics
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls reactjs-basics
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\manoos\my_prj\reactjs-basics\npm-debug.log

npm ERR! Windows_NT 6.1.7600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\manoos\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\n
pm-cli.js" "start"
npm ERR! node v5.6.0
npm ERR! npm  v3.10.7
npm ERR! code ELIFECYCLE
npm ERR! reactjs-basics@1.0.0 start: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the reactjs-basics@1.0.0 start script 'npm run build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the reactjs-basics package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs reactjs-basics
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls reactjs-basics
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\manoos\my_prj\reactjs-basics\npm-debug.log
PS C:\Users\manoos\my_prj\reactjs-basics>
下面给出了我的package.json文件

{
  "name": "reactjs-basics",
  "version": "1.0.0",
  "description": "some basic reactjs",
  "main": "index.js",
  "scripts": {
    "start": "npm run build",
    "build":"webpack -d && copy src/index.html dist/index.html && webpack-dev-server --content-base src/ --inline --hot",
    "build:prod":"webpack -p && copy src/index.html dist/index.html"
  },
  "keywords": [
    "reactjs"
  ],
  "author": "Manu Francis",
  "license": "ISC",
  "dependencies": {
    "react": "^15.3.1",
    "react-dom": "^15.3.1"
  },
  "devDependencies": {
    "babel-loader": "^6.2.5",
    "babel-preset-es2015": "^6.14.0",
    "babel-preset-react": "^6.11.1",
    "babel-preset-stage-2": "^6.13.0",
    "webpack": "^1.13.2",
    "webpack-dev-server": "^1.15.0"
  }
}
webpack.config.js文件如下

var webpack = require("webpack");
var path = require("path");

var DIST_DIR = path.resolve(__dirname,"dist");
var SRC_DIR = path.resolve(__dirname,"src");

var config = {
    entry: SRC_DIR + "app/index.js",
    output: {
        path: DIST_DIR+ "/app",
        filename: "bundle.js",
        publicPath: "/app/"
    },
    modules: {
        loaders: [
            {
                test: /\.js?/,
                include: SRC_DIR,
                loader: "babel-loader",
                query: {
                    presets: ["react","es2015","stage-2"]
                }
            }
        ]
    }

};

module.exports = config;

如何解决此错误?有人能帮忙吗?

你能把
条目:SRC_DIR+“app/index.js”改成
条目:SRC_DIR+“/app/index.js”吗,
并再次尝试执行
npm运行
。@DavidDomain:当我尝试npm运行时,我得到了reactjs basics中包含的生命周期脚本:通过
npm运行脚本启动npm运行构建
:构建网页包-d&© src/index.html dist/index.html&&webpack dev server--content base src/--inline--hot build:prodwebpack-p&在我尝试npm启动并出现相同错误后复制src/index.html dist/index.html。您可以将
条目:src_DIR+“app/index.js”
更改为
条目:src_DIR+“/app/index.js”,
并再次尝试执行
npm运行
。@DavidDomain:当我尝试npm运行时,我得到了reactjs basics中包含的生命周期脚本:通过
npm运行脚本启动npm运行构建
:构建网页包-d&© src/index.html dist/index.html&&webpack dev server--content base src/--inline--hot build:prodwebpack-p&在我尝试npm启动并得到相同错误后复制src/index.html dist/index.html