简体   繁体   English

尝试运行“ npm run start”脚本时显示“ errno 1”

[英]“errno 1” when trying to run “npm run start” script

I keep getting this error message when trying to run "npm run start" inside my project folder: 尝试在项目文件夹中运行“ npm run start”时,我一直收到此错误消息:

myLaptop:app-name userName$ npm run start

> app-name@0.1.0 start /Users/userName/My Documents/app-name
> node scripts/start.js

Cannot destructure property `compile` of 'undefined' or 'null'.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! app-name@0.1.0 start: `node scripts/start.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the app-name@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/userName/.npm/_logs/2018-12-09T16_26_00_758Z-debug.log

The base code was copied from this Medium post and was working when I started, but I think I may have changed something somewhere that's stopped it performing properly. 基本代码是从这篇Medium帖子复制而来的,并且在我开始工作时就可以使用,但是我想我可能已经更改了一些阻止它正常运行的地方。

Other information 其他资讯

  • Running npm version 6.4.1 运行npm 6.4.1版本
  • Running node version 10.14.1 运行节点版本10.14.1
  • I've re-ran npm install and npm audit 我已经重新运行了npm installnpm audit
  • I've re-installed npm and node 我已经重新安装了npm和node
  • I've deleted the node-modules folder and re-ran npm install 我删除了node-modules文件夹,然后重新运行npm install
  • I'm using VS-Code & git 我正在使用VS-Code和git
  • I've also installed the moment.js and lodash.js modules myself 我还亲自安装了moment.js和lodash.js模块

package.json package.json

{
    "name": "app-name",
    "version": "0.1.0",
    "private": true,
    "devDependencies": {},
    "dependencies": {
        "autoprefixer": "7.1.1",
        "babel-core": "6.25.0",
        "babel-eslint": "7.2.3",
        "babel-jest": "20.0.3",
        "babel-loader": "7.0.0",
        "babel-preset-react-app": "^3.0.1",
        "babel-runtime": "6.23.0",
        "case-sensitive-paths-webpack-plugin": "2.1.1",
        "chalk": "1.1.3",
        "css-hot-loader": "^1.3.5",
        "css-loader": "0.28.4",
        "dotenv": "4.0.0",
        "eslint": "3.19.0",
        "eslint-config-react-app": "^1.0.5",
        "eslint-loader": "1.7.1",
        "eslint-plugin-flowtype": "2.34.0",
        "eslint-plugin-import": "2.2.0",
        "eslint-plugin-jsx-a11y": "5.0.3",
        "eslint-plugin-react": "7.1.0",
        "extract-text-webpack-plugin": "2.1.2",
        "file-loader": "0.11.2",
        "fs-extra": "3.0.1",
        "gh-pages": "^1.0.0",
        "html-webpack-plugin": "2.29.0",
        "jest": "20.0.4",
        "lodash": "^4.17.11",
        "moment": "^2.22.2",
        "node-sass": "^4.5.3",
        "object-assign": "4.1.1",
        "postcss-flexbugs-fixes": "3.0.0",
        "postcss-loader": "2.0.6",
        "promise": "7.1.1",
        "react": "^15.6.1",
        "react-dev-utils": "^3.0.2",
        "react-dom": "^15.6.1",
        "react-error-overlay": "^1.0.9",
        "sass-loader": "^6.0.6",
        "style-loader": "0.18.2",
        "sw-precache-webpack-plugin": "0.11.3",
        "url-loader": "^1.1.2",
        "webpack": "2.6.1",
        "webpack-dev-server": "^3.1.10",
        "webpack-manifest-plugin": "1.1.0",
        "whatwg-fetch": "2.0.3"
    },
    "scripts": {
        "start": "node scripts/start.js",
        "predeploy": "npm run build",
        "deploy": "gh-pages -d build",
        "build": "node scripts/build.js",
        "test": "node scripts/test.js --env=jsdom"
    },
    "jest": {
        "collectCoverageFrom": [
            "src/**/*.{js,jsx}"
        ],
        "setupFiles": [
            "<rootDir>/config/polyfills.js"
        ],
        "testMatch": [
            "<rootDir>/src/**/__tests__/**/*.js?(x)",
            "<rootDir>/src/**/?(*.)(spec|test).js?(x)"
        ],
        "testEnvironment": "node",
        "testURL": "http://localhost",
        "transform": {
            "^.+\\.(js|jsx)$": "<rootDir>/node_modules/babel-jest",
            "^.+\\.css$": "<rootDir>/config/jest/cssTransform.js",
            "^(?!.*\\.(js|jsx|css|json)$)": "<rootDir>/config/jest/fileTransform.js"
        },
        "transformIgnorePatterns": [
            "[/\\\\]node_modules[/\\\\].+\\.(js|jsx)$"
        ],
        "moduleNameMapper": {
            "^react-native$": "react-native-web"
        },
        "moduleFileExtensions": [
            "web.js",
            "js",
            "json",
            "web.jsx",
            "jsx",
            "scss"
        ]
    },
    "babel": {
        "presets": [
            "react-app"
        ]
    },
    "eslintConfig": {
        "extends": "react-app"
    }
}

Please downgrade the version of webpack-dev-server to version 3.0.0. 请将webpack-dev-server的版本降级为3.0.0。

also webpack-dev-server 3.x is only compatible with webpack 4.x, due to the peer dependencies. 另外,由于对等方的依赖性,webpack-dev-server 3.x仅与webpack 4.x兼容。

Try to use the latest vsersion of webpack , since you are using the webpack version of 2.xx, the latest is 4.27.1 尝试使用最新的webpack版本,因为您使用的是2.xx版本的webpack,因此最新版本为4.27.1

I hope this will solve the issue. 我希望这可以解决问题。

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

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