Nodejs environment problem: error spawn CMD enoent at process

Reading time |1.33 minutes word count |2129.6 characters
primary coverage |1. Introduction & background
“Nodejs environment problem: error spawn CMD enoent at process…”
Author | SCscHero Writing time | 2021/12/31 PM11:49
Article type |Series Degree of completion |Completed
motto Every great cause has a trivial beginning.

1、 Introduction & backgroundCompletion: 100%

a) Dealing with problems

Recently, there was something wrong with my colleagues’ Vue environmentHereticalProblem, the front-end code that could have run suddenly reported an error and couldn’t start, so help him have a look and record the problem. The following error messages and codes.

b) Error message

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'dev'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle [email protected]~predev: [email protected]
6 info lifecycle [email protected]~dev: [email protected]
7 verbose lifecycle [email protected]~dev: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~dev: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;c:\CodeFile\XXXX\Target-Agreement\TAOnline\Presentation\SCscHero.web\node_modules\.bin;C:\Program Files\nodejs\;C:\Program Files\MySQL\MySQL Shell 8.0\bin\;C:\Users\SCscHero\AppData\Local\Microsoft\WindowsApps;C:\Users\SCscHero\AppData\Local\Programs\Git\cmd;C:\Program Files\Azure Data Studio\bin;C:\Users\SCscHero\.dotnet\tools;C:\Users\SCscHero\AppData\Roaming\npm
9 verbose lifecycle [email protected]~dev: CWD: c:\CodeFile\XXXX\Target-Agreement\TAOnline\Presentation\SCscHero.web
10 silly lifecycle [email protected]~dev: Args: [ '/d /s /c', 'vue-cli-service serve' ]
11 silly lifecycle [email protected]~dev: Returned: code: 1  signal: null
12 info lifecycle [email protected]~dev: Failed to exec dev script
13 verbose stack Error: [email protected] dev: `vue-cli-service serve`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:311:20)
13 verbose stack     at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:311: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 [email protected]
15 verbose cwd c:\CodeFile\XXXX\Target-Agreement\TAOnline\Presentation\SCscHero.web
16 verbose Windows_NT 10.0.19043
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v12.16.1
19 verbose npm  v6.13.4
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] dev: `vue-cli-service serve`
22 error Exit status 1
23 error Failed at the [email protected] dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

c) Screenshot of error reporting

The following error is reported:

Nodejs environment problem: error spawn CMD enoent at process

2、 SolutionCompletion: 100%

a) Troubleshooting ideas

  1. At first, I thought that the problem of dependencies could not be solved after all dependencies were reinstalled. At first, I thought it was a Vue cli or other dependency version problem.
  2. Later, Taobao image was used to switch the source and reinstall itno way。 I tortured him.
  3. I searched the Internet and thought it was the problem of environment variables, but setting the CMD program path to the path variable is still a problemno way
  4. Later, I found some online programs, orno way

b) Solution

Finally, my colleagues tossed about the nodejs version themselves: delete the original nodejs12 version, install the latest version 14, and then reinstall the version 12

3、 Statements and referencesCompletion: 100%

Original blog post, please do not reprint without permission.

If you are helpful, you are welcome to like, collect and pay attention. If you have any questions, please comment! If you need to contact the blogger, you can write scschero directly.