当我试图用npm start命令调试我的节点应用程序时,我收到了这个错误。

Error:
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3

npm ERR! missing script: start
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\andrmoll.NORTHAMERICA\Documents\GitHub\SVIChallenge\npm-debug.log
From the debug file:
Error: missing script: start
       at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:142:19)
       at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:58:5
       at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:345:5
       at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:309:45)
       at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:343:3)
       at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:113:5)
       at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:300:12
       at evalmachine.<anonymous>:334:14
       at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:102:5
       at FSReqWrap.oncomplete (evalmachine.<anonymous>:95:15)

当前回答

根据react文档https://create-react-app.dev/docs/getting-started/ 下面的命令将解决这个问题。

npx create-react-app my-app
cd my-app
npm start

其他回答

我在第一次安装react-js时遇到了类似的问题:这几行帮助我解决了问题:

npm uninstall -g create-react-app
npm rm -g create-react-app
npm install -g create-react-app
npx create-react-app my-app

这对我来说很管用。

我也有同样的问题。我试图在VS code终端启动它。所以我在我的计算机终端中启动开发环境(而不是在VS Code中)。它工作。在启动该文件之前,请确保您在终端中的文件中

请在package.json中的script object中使用下面这行代码

"scripts": {
    "start": "webpack-dev-server --hot"
}

对我来说,它运行得非常好。

我已经解决了我的问题。这不是一个NPM错误,它与代理行为有关。

如果你不支持代理,

MAC
 1.  Goto System Preference (gears icon on your mac)
 2.  click your network
 3.  click advanced
 4.  click proxy
 5.  check excludes simple hostnames
 6.  add this line below (Bypass Proxy Settings...) "localhost, localhost:8080"

refer to the npm echo: "Project is running at http://localhost:8080/"

Windows
 1.  Goto your browser Proxy Settings (google it)
 2.  check Bypass local address
 3.  add this line below "localhost, localhost:8080"

应避免使用不稳定的NPM版本。

我观察到一件事,这是基于npm版本的问题,npm 4.6.1版本是稳定的,但5。X不稳定是因为包。Json将配置完美,而创建与默认模板,如果它是一个稳定的版本,所以我们手动不需要添加脚本。

我在npm 5上得到了下面的问题,所以我降级到npm 4.6.1,然后它为我工作,


错误:目前还不支持npm 5


看起来你正在使用最近发布的npm 5。

不幸的是,Create React Native App还不能与npm 5一起工作。我们 建议使用NPM 4或yarn,直到一些bug被解决。

你可以在以下地址查看npm 5的已知问题: https://github.com/npm/npm/issues/16991


Devas-MacBook-Air:SampleTestApp deva$ npm start npm犯错!缺少脚本:start