如何运行npm.cmd?

时间:2019-08-07 07:57:54

标签: npm

我偶然发现了这个讨论: https://github.com/nodejs/node/issues/3675

在搜索该错误时:

{ Error: spawn npm ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
  errno: 'ENOENT',
  code: 'ENOENT',
  syscall: 'spawn npm',
  path: 'npm',
  spawnargs: [ 'root', '-g' ] }

但我不知道如何访问此npm.cmd。我在他们的网站https://www.npmjs.com/package/node-cmd上 我用npm install node-cmd安装了它 但是我不太了解如何运行它,输入

时出现这样的错误
npm run node-cmd

npm ERR! path D:\nodeJS\node-v10.16.0-win-x64\package.json
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open 'D:\nodeJS\node-v10.16.0-win-x64\package.json'
npm ERR! enoent This is related to npm not being able to find a file.

基本上,我想在项目中运行此node-cmd,以便(希望)执行:

npx webpack-cli init

成功

1 个答案:

答案 0 :(得分:1)

如果您在win32下运行,请尝试例如:

安装软件包时

npm.cmd install

或同步运行npm脚本

npm.cmd run sync -- --init