当前位置: 首页 > 知识库问答 >
问题:

如何修复npm错误!缺少脚本:在react中启动

赵炯
2023-03-14

当我运行npm start时,我看到错误。

我尝试过这个方法,但没有成功:https://techoverflow.net/2019/04/01/how-to-fix-npm-err-missing-script-start/

{“private”:true,“scripts”:{“dev”:“npm运行development”,“development”:“cross-env node_env=development node_modules/webpack/bin/webpack.js”,“watch”:“cross-env node_env=development node_modules/webpack/bin/webpack.js”,“watch”:“cross-env node_env=development node_modules/webpack.js”,“cross-env“bootstrap-sass”:“^3.3.7”,“cross-env”:“^5.2.0”,“jquery”:“^3.2”,“laravel-mix”:“^1.0”,“lodash”:“^4.17.11”,“react”:“^16.5.1”,“react-dom”:“^16.4.0”},“dependencies”:{“antd”:“^3.12.4”,“babel-plugin-import”:“^1.8.0”,“css-loader”:“^2.1.0”,“less-loader”:“^3.9.0”,“less-loader”:“^4.1.0”,“

共有1个答案

龙飞
2023-03-14

package.json中缺少名为“start”的脚本。查看脚本/start line并在您的package.json中添加相同的(但对您的文件进行了修改)

{
"private": true,
"scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "start": "node index.js"
},
"devDependencies": {
    "axios": "^0.17.1",
    "babel-plugin-syntax-dynamic-import": "^6.18.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-preset-react": "^6.23.0",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^5.2.0",
    "jquery": "^3.2",
    "laravel-mix": "^1.0",
    "lodash": "^4.17.11",
    "react": "^16.5.1",
    "react-dom": "^16.4.0"
},
"dependencies": {
    "antd": "^3.12.4",
    "babel-plugin-import": "^1.8.0",
    "css-loader": "^2.1.0",
    "less": "^3.9.0",
    "less-loader": "^4.1.0",
    "moment": "^2.22.2",
    "moment-timezone": "^0.5.21",
    "react-addons-update": "^15.6.2",
    "react-redux": "^5.0.7",
    "react-responsive-modal": "^4.0.1",
    "react-router-dom": "^4.3.1",
    "redux": "^4.0.0",
    "redux-thunk": "^2.3.0",
    "style-loader": "^0.23.1"
}

}

 类似资料:
  • 当我运行npm运行json: server时,我得到了这个错误。 npm错误!缺少脚本:json: 当我打开日志文件时,它是这样说的: 0信息,如果它以ok结束1详细cli['C:\Program Files\nodejs\node.exe',1详细cli'C:\用户\IanP\AppData\漫游\npm\node_modules\npm\bin\npm-cli.js',1详细cli'run',

  • 我试图在服务器端运行我的Angular应用程序,但我遇到了以下错误: npm错误!缺少脚本:Build:Universal

  • npm错误!此运行的完整日志可以在:npm err!C:\users\ttopo\appdata\roaming\npm-cache_logs\2020-11-20t07_58_40_339z-debug.log` 0信息如果它以ok结束就可以工作1详细cli[1详细cli'c:\program Files\nodejs\node.exe',1详细cli'c:\program Files\node

  • 尝试使用Visual Studio Code上的npm start命令运行节点应用程序时收到此错误。非常感谢任何帮助! 这是我包裹里的东西。json文件: 这是我运行代码时终端上的消息:

  • 我有几个小反应网络应用程序,我已经做了,我试图部署到heroku。我通过youtube视频找到了这个https://github.com/mars/create-react-app-buildpack,据说这是/是一个简单的部署方法。作者列出了几个步骤(前两个不适用): git初始化 heroku创建$APP_NAME--Buildpackhttps://github.com/mars/creat

  • 在Laravel 6中安装npm时,我有一个错误,它现在正在工作,我不知道,尽管我按顺序完成了所有步骤 这是我的版本: Laravel版本6 npm 6.13.7 Node 13.5.0 我按顺序做了这件事 但是当npm运行dev它的错误显示 错误。/资源/sass/app.scss模块构建失败(来自。/node_modules/css-loader/index.js):模块构建错误:模块构建失败