简体   繁体   English

得到错误! 缺少脚本:开始于 <npm start> 命令

[英]Getting ERR! missing script: start on <npm start> command

When I run npm start, I get the dreaded "npm ERR! missing script: start" 当我运行npm start时,我得到了可怕的“ npm ERR!missing script:start”


Already tried changing the "start" line in the package.json in every way shown here and on Google going back a full year. 已经尝试以这里显示的所有方式以及在整整一年的Google上更改package.json中的“开始”行。

Also tried installing just about every stable node/npm stable release from the current to 12.x. 还尝试安装从当前版本到12.x的几乎每个稳定节点/ npm稳定发行版。 Deleted yarn just to be sure. 只是为了确保删除了纱线。 Wnet back to current release. Wnet返回当前版本。

Ran everything from npm init to npm create-react-app [project folder] node_modules are there. 从npm init到npm create-react-app [项目文件夹] node_modules的所有文件都在那里。

The script for run does show up in the package.json. 运行的脚本确实显示在package.json中。

Deleted the project directory,deleted the repository and re-cloned the depository fresh. 删除项目目录,删除存储库,然后重新克隆新的存储库。


OS: Linux Mint 19.1 Cinnamon Linux Mint 19.1 is based on Ubuntu 18.04.1 Vs Code 1.37.1 - all extensions disabled. 操作系统:Linux Mint 19.1 Cinnamon Linux Mint 19.1基于Ubuntu 18.04.1 Vs代码1.37.1-禁用所有扩展。

$ npm -v
6.9.0

$ whereis node
node: /usr/bin/node /usr/include/node /usr/share/man/man1/node.1.gz

$ which npm 
/usr/bin/npm

*******************************************
*package.json*:
{
  "main": "index.js",
  "name": "team-builder",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.9.0",
    "react-dom": "^16.9.0",
    "react-scripts": "3.1.1"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"

  },
  "eslintConfig": {
    "extends": "react-app"
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
  • Note: I've tried every variant of the start script posted here in the past year. 注意:过去一年中,我已经尝试过在此处发布的启动脚本的所有变体。

debug.log: 的debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.9.0
3 info using node@v10.16.3
4 verbose config Skipping project config: /home/mark/.npmrc. (matches 
 userconfig)
5 verbose stack Error: missing script: start
5 verbose stack     at run (/usr/lib/node_modules/npm/lib/run- 
 script.js:155:19)
5 verbose stack     at /usr/lib/node_modules/npm/lib/run- 
 script.js:63:5
5 verbose stack     at /usr/lib/node_modules/npm/node_modules/read- 
  package-json/read-json.js:115:5
5 verbose stack     at /usr/lib/node_modules/npm/node_modules/read- 
 package-json/read-json.js:418:5
5 verbose stack     at checkBinReferences_ 
  (/usr/lib/node_modules/npm/node_modules/read-package-json/read- 
 json.js:373:45)
5 verbose stack     at final 
  (/usr/lib/node_modules/npm/node_modules/read-package-json/read - 
 json.js:416:3)
5 verbose stack     at then 
  (/usr/lib/node_modules/npm/node_modules/read-package-json/read- 
  json.js:160:5)
5 verbose stack     at ReadFileContext.<anonymous> 
  (/usr/lib/node_modules/npm/node_modules/read-package-json/read- 
 json.js:3 32:20)
5 verbose stack     at ReadFileContext.callback 
 (/usr/lib/node_modules/npm/node_modules/graceful-fs/graceful- 
 fs.js:90:16)
5 verbose stack     at FSReqWrap.readFileAfterOpen [as oncomplete] 
 (fs.js:237:13)
6 verbose cwd /home/mark/OneDrive/Repositories/team-builder
7 verbose Linux 4.15.0-58-generic
8 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
9 verbose node v10.16.3
10 verbose npm  v6.9.0
11 error missing script: start
12 verbose exit [ 1, true ]

I've tried just about everything. 我已经尝试了几乎所有东西。 I hope you all can help. 希望大家能提供帮助。 npm start won't run, so I'm basically coding blind - nothing to the monitor, no Chrome React devTools. npm start不会运行,所以我基本上是在盲目编码-监视器没有任何内容,没有Chrome React devTools。

Your scripts section looks off in your package.json perhaps you can change your start script to the following: 您的scripts部分在package.json关闭,也许您可​​以将启动脚本更改为以下内容:

"start": "react-scripts start",

For full reference your scripts section should look similar to this, assuming you're trying to use react bootstrapped with the create-react-app cli: 对于完整的参考脚本部分应类似于此,假设你正在尝试使用react与自举create-react-app的CLI:

package.json 的package.json

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  }

Hopefully that helps! 希望有帮助!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM