Javascriptservices: Cannot find module aspnet-webpack (Angular2)

Created on 6 Jan 2017  路  2Comments  路  Source: aspnet/JavaScriptServices

Created a new app and used the dotnet cli to prepare the application for deployment within a Docker container or FTP to Azure App Service (Linux)

Create generator to scaffold VS2017 version (.csproj)
run publish command to prepare app for deploy to production

dotnet publish -o app -c Release

Test app

cd app
dotnet myapp.dll

Result

Unhandled Exception: System.AggregateException: One or more errors occurred. (Call to Node module failed with error: Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. Error was: Error: Cannot find module 'aspnet-webpack'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/private/var/folders/gj/1mgg_4jx7mbdqbhw1kgcpcjr0000gn/T/tmpQm4YDb.tmp:83:19)
    at __webpack_require__ (/private/var/folders/gj/1mgg_4jx7mbdqbhw1kgcpcjr0000gn/T/tmpQm4YDb.tmp:20:30)
    at createWebpackDevServer (/private/var/folders/gj/1mgg_4jx7mbdqbhw1kgcpcjr0000gn/T/tmpQm4YDb.tmp:62:26)
    at /private/var/folders/gj/1mgg_4jx7mbdqbhw1kgcpcjr0000gn/T/tmpbXKtMq.tmp:113:19
    at IncomingMessage.<anonymous> (/private/var/folders/gj/1mgg_4jx7mbdqbhw1kgcpcjr0000gn/T/tmpbXKtMq.tmp:132:38)
    at emitNone (events.js:86:13)
Current directory is: /app) ---> System.Exception: Call to Node module failed with error: Webpack dev middleware failed because of an error while loading 'aspnet-webpack'. Error was: Error: Cannot find module 'aspnet-webpack'
    at Function.Module._resolveFilename (module.js:440:15)
    at Function.Module._load (module.js:388:25)
    at Module.require (module.js:468:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/private/var/folders/gj/1mgg_4jx7mbdqbhw1kgcpcjr0000gn/T/tmpQm4YDb.tmp:83:19)
    at __webpack_require__ (/private/var/folders/gj/1mgg_4jx7mbdqbhw1kgcpcjr0000gn/T/tmpQm4YDb.tmp:20:30)
    at createWebpackDevServer (/private/var/folders/gj/1mgg_4jx7mbdqbhw1kgcpcjr0000gn/T/tmpQm4YDb.tmp:62:26)
    at /private/var/folders/gj/1mgg_4jx7mbdqbhw1kgcpcjr0000gn/T/tmpbXKtMq.tmp:113:19
    at IncomingMessage.<anonymous> (/private/var/folders/gj/1mgg_4jx7mbdqbhw1kgcpcjr0000gn/T/tmpbXKtMq.tmp:132:38)
    at emitNone (events.js:86:13)
Current directory is: /app
   at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext()

Most helpful comment

ASPNETCORE_ENVIRONMENT was set to Development

All 2 comments

ASPNETCORE_ENVIRONMENT was set to Development

Thank you #spboyer That was it!

Was this page helpful?
0 / 5 - 0 ratings