如何解决Windows 10中的npm start错误?

时间:2020-10-02 13:09:36

标签: javascript node.js reactjs npm npm-start

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Windows\\System32\\node.exe',
1 verbose cli   'C:\\Users\\Ratan\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'start'
1 verbose cli ]
2 info using npm@6.14.8
3 info using node@v12.18.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle myapp@0.1.0~prestart: myapp@0.1.0
6 info lifecycle myapp@0.1.0~start: myapp@0.1.0
7 verbose lifecycle myapp@0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle myapp@0.1.0~start: PATH: C:\Users\Ratan\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\Ratan\Desktop\myapp_routing\node_modules\.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\;C:\Users\Ratan\AppData\Local\Microsoft\WindowsApps;;C:\Users\Ratan\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\Ratan\AppData\Roaming\npm
9 verbose lifecycle myapp@0.1.0~start: CWD: C:\Users\Ratan\Desktop\myapp_routing
10 silly lifecycle myapp@0.1.0~start: Args: [ '/d /s /c', 'PORT=3006 react-scripts start' ]
11 silly lifecycle myapp@0.1.0~start: Returned: code: 1  signal: null
12 info lifecycle myapp@0.1.0~start: Failed to exec start script
13 verbose stack Error: myapp@0.1.0 start: `PORT=3006 react-scripts start`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Users\Ratan\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:315:20)
13 verbose stack     at ChildProcess.<anonymous> (C:\Users\Ratan\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:315:20)
13 verbose stack     at maybeClose (internal/child_process.js:1021:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid myapp@0.1.0
15 verbose cwd C:\Users\Ratan\Desktop\myapp_routing
16 verbose Windows_NT 10.0.15063
17 verbose argv "C:\\Windows\\System32\\node.exe" "C:\\Users\\Ratan\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v12.18.4
19 verbose npm  v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error myapp@0.1.0 start: `PORT=3006 react-scripts start`
22 error Exit status 1
23 error Failed at the myapp@0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

在执行npm启动时抛出此错误。 我也尝试在system32中安装node js。 我尝试删除node_modules,package-lock.json并清除缓存仍然遇到相同的问题。

规格- Windows 10, 英特尔i5, 4GB Ram

Visual Studio-

版本:1.49.2(用户设置)提交: e5e9e69aed6e1984f7499b7af85b3d05f9a6883a日期: 2020-09-24T16:29:41.983Z电子:9.2.1铬:83.0.4103.122 Node.js:12.14.1 V8:8.3.110.13-electron.0操作系统:Windows_NT x64 10.0.15063

 {
      "name": "myapp",
      "version": "0.1.0",
      "private": true,
      "dependencies": {
        "@date-io/date-fns": "^1.3.13",
        "@material-ui/core": "^4.11.0",
        "@material-ui/icons": "^4.9.1",
        "@material-ui/pickers": "^3.2.10",
        "@testing-library/jest-dom": "^4.2.4",
        "@testing-library/react": "^9.5.0",
        "@testing-library/user-event": "^7.2.1",
        "axios": "^0.20.0",
        "date-fns": "^2.16.1",
        "node-sass": "^4.14.1",
        "react": "^16.13.1",
        "react-dom": "^16.13.1",
        "react-redux": "^7.2.1",
        "react-router-dom": "^5.2.0",
        "react-scripts": "3.4.1",
        "react-semantic-ui-datepickers": "^2.9.1",
        "redux": "^4.0.5",
        "redux-thunk": "^2.3.0",
        "semantic-ui-css": "^2.4.1",
        "semantic-ui-react": "^1.2.1",
        "weather-icons-react": "^1.2.0"
      },
      "scripts": {
        "start": "PORT=3006 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"
        ]
      }
    }

0 个答案:

没有答案