webpack'不被识别为内部或外部命令

时间:2018-08-20 14:37:29

标签: npm npm-install

我正在尝试运行npm run build,它给我以下错误:

'webpack' is not recognized as an internal or external command,

我尝试删除node_modules文件夹并运行:npm install,但这并不能解决问题。 是否有人有这个问题的经验,可以提出解决方案?

0 info it worked if it ends with ok
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   'build' ]
2 info using npm@6.1.0
3 info using node@v10.5.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle %APPLICATIONNAME%.website@1.0.0~prebuild: %APPLICATIONNAME%.website@1.0.0
6 info lifecycle %APPLICATIONNAME%.website@1.0.0~build: %APPLICATIONNAME%.website@1.0.0
7 verbose lifecycle %APPLICATIONNAME%.website@1.0.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle %APPLICATIONNAME%.website@1.0.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\%USER%\source\repos\%APPLICATIONNAME%\%APPLICATIONNAME%\%APPLICATIONNAME%.Website\node_modules\.bin;C:\Users\%USER%\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\%USER%\bin;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files\Git\cmd;C:\Program Files (x86)\dotnet;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\nodejs;C:\WINDOWS\System32\OpenSSH;C:\ProgramData\Oracle\Java\javapath;C:\Program Files (x86)\Intel\iCLS Client;C:\Program Files\Intel\iCLS Client;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin;C:\Program Files\Common Files\Intel\WirelessCommon;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\dotnet;C:\Program Files\Microsoft SQL Server\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\DTS\Binn;C:\Program Files (x86)\Microsoft SQL Server\140\Tools\Binn\ManagementStudio;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\130\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\Tools\Binn;C:\Program Files\Microsoft SQL Server\140\DTS\Binn;C:\Program Files\Git\cmd;C:\Program Files (x86)\dotnet;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\Program Files\nodejs;C:\WINDOWS\System32\OpenSSH;C:\Users\%USER%\AppData\Local\Microsoft\WindowsApps;C:\Users\%USER%\.dotnet\tools;C:\Users\%USER%\AppData\Roaming\npm;C:\Users\%USER%\AppData\Local\Microsoft\WindowsApps;C:\Users\%USER%\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
9 verbose lifecycle %APPLICATIONNAME%.website@1.0.0~build: CWD: C:\Users\%USER%\source\repos\%APPLICATIONNAME%\%APPLICATIONNAME%\%APPLICATIONNAME%.Website
10 silly lifecycle %APPLICATIONNAME%.website@1.0.0~build: Args: [ '/d /s /c',
10 silly lifecycle   'webpack --config webpack.config.js --progress --profile' ]
11 silly lifecycle %APPLICATIONNAME%.website@1.0.0~build: Returned: code: 1  signal: null
12 info lifecycle %APPLICATIONNAME%.website@1.0.0~build: Failed to exec build script
13 verbose stack Error: %APPLICATIONNAME%.website@1.0.0 build: `webpack --config webpack.config.js --progress --profile`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:304:16)
13 verbose stack     at EventEmitter.emit (events.js:182:13)
13 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:182:13)
13 verbose stack     at maybeClose (internal/child_process.js:961:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:5)
14 verbose pkgid %APPLICATIONNAME%.website@1.0.0
15 verbose cwd C:\Users\%USER%\source\repos\%APPLICATIONNAME%\%APPLICATIONNAME%\%APPLICATIONNAME%.Website
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v10.5.0
19 verbose npm  v6.1.0
20 error code ELIFECYCLE
21 error errno 1
22 error %APPLICATIONNAME%.website@1.0.0 build: `webpack --config webpack.config.js --progress --profile`
22 error Exit status 1
23 error Failed at the reptune.website@1.0.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

1 个答案:

答案 0 :(得分:0)

如果没有更多上下文,很难说,但是如果您的代码使用的是Webpack的较新版本,请确保还安装了webpack命令行工具,这些工具现在位于单独的npm模块public ActionResult Synonym() { string searchServiceName = "xxx"; string apiKey = "123123123123123123123123123"; SearchServiceClient serviceClient = new SearchServiceClient(searchServiceName, new SearchCredentials(apiKey)); var indexClient = serviceClient.Indexes.GetClient("produtos"); var synonymMap = new SynonymMap() { Name = "marca-synonymmap", Format = "solr", Synonyms = @" dolve, douve => dove\n " }; serviceClient.SynonymMaps.CreateOrUpdate(synonymMap); return Content("OK"); } 中。