Skip to content
This repository has been archived by the owner on Sep 4, 2024. It is now read-only.

Webpack fails in deploy.cmd with odd pathing error #2032

Closed
deevus opened this issue Jun 3, 2016 · 7 comments
Closed

Webpack fails in deploy.cmd with odd pathing error #2032

deevus opened this issue Jun 3, 2016 · 7 comments

Comments

@deevus
Copy link

deevus commented Jun 3, 2016

Preface: npm/npm#12931

I thought that my issue would be solved by running webpack directly from deploy.cmd, but I get the same output as linked. I was also able to get it to fail in the Kudu Powershell console by running the local webpack copy using node

PS D:\home\site\wwwroot> node .\node_modules\webpack\bin\webpack.js --config .\config\webpack.config.js --bail
[webpack-validator] Config is valid.
clean-webpack-plugin: D:\home\site\wwwroot\public\* has been removed.
ts-loader: Using typescript@1.8.10 and D:\home\site\wwwroot\tsconfig.json
ModuleNotFoundError: Module not found: Error: Cannot resolve 'file' or 'directory' ./100.78.116.21/volume-1-default/93ed3614bdcf632e2c04/7727d4897b44417fbda402e033601851/site/wwwroot/node_modules/webpack/buildin/module.js in D:\home\site\wwwroot\node_modules\moment
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\webpack\lib\Compilation.js:229:38
    at onDoneResolving (\\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\webpack\lib\NormalModuleFactory.js:29:20)
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\webpack\lib\NormalModuleFactory.js:85:20
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\async\lib\async.js:726:13
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\async\lib\async.js:52:16
    at done (\\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\async\lib\async.js:241:17)
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\async\lib\async.js:44:16
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\async\lib\async.js:723:17
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\async\lib\async.js:167:37
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\enhanced-resolve\lib\UnsafeCachePlugin.js:24:19
    at onResolved (\\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\enhanced-resolve\lib\Resolver.js:38:18)
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\enhanced-resolve\lib\Resolver.js:127:10
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\enhanced-resolve\lib\Resolver.js:191:15
    at applyPluginsParallelBailResult.createInnerCallback.log (\\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\enhanced-resolve\lib\Resolver.js:110:4)
    at loggingCallbackWrapper (\\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\enhanced-resolve\lib\createInnerCallback.js:21:19)
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\tapable\lib\Tapable.js:134:6
    at Tapable.<anonymous> (\\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\enhanced-resolve\lib\FileAppendPlugin.js:31:26)
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\enhanced-resolve\lib\Resolver.js:191:15
    at \\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\enhanced-resolve\lib\FileAppendPlugin.js:28:12
    at Storage.finished (\\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\enhanced-resolve\lib\CachedInputFileSystem.js:38:16)
    at FSReqWrap.oncomplete (fs.js:117:15)
resolve directory
  D:\home\site\wwwroot\node_modules\moment\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\webpack\buildin\module.js doesn't exist (directory default file)
  D:\home\site\wwwroot\node_modules\moment\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\webpack\buildin\module.js\package.json doesn't exist (directory description file)
resolve file
  D:\home\site\wwwroot\node_modules\moment\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\webpack\buildin\module.js.tsx doesn't exist
  D:\home\site\wwwroot\node_modules\moment\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\webpack\buildin\module.js.ts doesn't exist
  D:\home\site\wwwroot\node_modules\moment\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\webpack\buildin\module.js doesn't exist
  D:\home\site\wwwroot\node_modules\moment\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\webpack\buildin\module.js.js doesn't exist
  D:\home\site\wwwroot\node_modules\moment\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\webpack\buildin\module.js.jsx doesn't exist

However, if I install a global version of webpack in the console, it works

PS D:\home\site\wwwroot> npm i -g webpack
D:\local\AppData\npm\webpack -> D:\local\AppData\npm\node_modules\webpack\bin\webpack.js
**snipped***
PS D:\home\site\wwwroot> webpack --config .\config\webpack.config.js --bail
[webpack-validator] Config is valid.
clean-webpack-plugin: D:\home\site\wwwroot\public\* has been removed.
ts-loader: Using typescript@1.8.10 and D:\home\site\wwwroot\tsconfig.json
ts-loader: Using typescript@1.8.10 and D:\home\site\wwwroot\lib\components\tsconfig.json
Hash: 8315fc83d80c43ed96cd
Version: webpack 1.13.1
Time: 133892ms
                                 Asset       Size  Chunks             Chunk Names
      manifest.01ca4e3cbf72572a201e.js    1.31 kB       3  [emitted]  manifest
                           favicon.ico    5.43 kB          [emitted]  
448c34a56d699c29117adc64c43affeb.woff2      18 kB          [emitted]  
 fa2772327f55d8198301fdb8bcfc8158.woff    23.4 kB          [emitted]  
  e18bbf611f2a2e43afc071aa2f4e1512.ttf    45.4 kB          [emitted]  
  img/glyphicons-halflings-regular.svg     109 kB          [emitted]  
        client.7e4955d8df6fba9f6c1e.js     231 kB    0, 3  [emitted]  client
         style.df8137154c79c5e5655a.js  143 bytes    1, 3  [emitted]  style
        vendor.60851b4468e32baa0991.js     988 kB    2, 3  [emitted]  vendor
  f4769f9bdb7466be65088239c12046d1.eot    20.1 kB          [emitted]  
       client.7e4955d8df6fba9f6c1e.css    1.97 kB    0, 3  [emitted]  client
        style.df8137154c79c5e5655a.css   99 bytes    1, 3  [emitted]  style
    client.7e4955d8df6fba9f6c1e.js.map    2.67 MB    0, 3  [emitted]  client
   client.7e4955d8df6fba9f6c1e.css.map  108 bytes    0, 3  [emitted]  client
     style.df8137154c79c5e5655a.js.map  706 bytes    1, 3  [emitted]  style
    style.df8137154c79c5e5655a.css.map  107 bytes    1, 3  [emitted]  style
    vendor.60851b4468e32baa0991.js.map    7.35 MB    2, 3  [emitted]  vendor
  manifest.01ca4e3cbf72572a201e.js.map    11.7 kB       3  [emitted]  manifest
                            index.html  566 bytes          [emitted]  
   [0] multi client 40 bytes {0} [built]
   [0] multi style 40 bytes {1} [built]
   [0] multi vendor 256 bytes {2} [built]
    + 1092 hidden modules
Child html-webpack-plugin for "index.html":
        + 3 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules
Child extract-text-webpack-plugin:
        + 2 hidden modules

I'm going to try to use a global version of webpack in deploy.cmd and report back.

@deevus
Copy link
Author

deevus commented Jun 3, 2016

Using a globally installed webpack from deploy.cmd worked

> statsone-team@0.1.0 tsc:webpack D:\home\site\wwwroot
> tsc ./config/webpack.config.ts ./typings/index.d.ts ./node_modules/typescript/lib/lib.es6.d.ts

[webpack-validator] Config is valid.
ts-loader: Using typescript@1.8.10 and D:\home\site\wwwroot\lib\components\tsconfig.json
ts-loader: Using typescript@1.8.10 and D:\home\site\wwwroot\lib\components\tsconfig.json
Hash: f844bae6ba0a8f060480
Version: webpack 1.13.1
Time: 81004ms
                                 Asset       Size  Chunks             Chunk Names
                           favicon.ico    5.43 kB          [emitted]  
  f4769f9bdb7466be65088239c12046d1.eot    20.1 kB          [emitted]  
448c34a56d699c29117adc64c43affeb.woff2      18 kB          [emitted]  
 fa2772327f55d8198301fdb8bcfc8158.woff    23.4 kB          [emitted]  
  e18bbf611f2a2e43afc071aa2f4e1512.ttf    45.4 kB          [emitted]  
  img/glyphicons-halflings-regular.svg     109 kB          [emitted]  
                             client.js    10.7 MB       0  [emitted]  client
                              style.js    1.41 MB       1  [emitted]  style
                            index.html  241 bytes          [emitted]  
   [0] multi style 40 bytes {1} [built]
   [0] multi client 40 bytes {0} [built]
    + 1173 hidden modules
Child html-webpack-plugin for "index.html":
        + 3 hidden modules
Finished successfully.

@sahat
Copy link

sahat commented Jun 3, 2016

Can confirm @deevus's findings, using globally installed Webpack works. Without installing Webpack globally I get a similar issue:

webpack fail

@davidebbo
Copy link
Member

Not really sure what's going on, by I'm guessing it's getting confused between the two different forms for the same path, e.g.

./100.78.116.21/volume-1-default/93ed3614bdcf632e2c04/7727d4897b44417fbda402e033601851/site/wwwroot/...

vs

D:\home\site\wwwroot\...

It ends up appending them instead of correctly resolving the relative ref, resulting in a monster path (note how site\wwwroot\node_modules is repeated):

D:\home\site\wwwroot\node_modules\moment\100.78.116.21\volume-1-default\93ed3614bdcf632e2c04\7727d4897b44417fbda402e033601851\site\wwwroot\node_modules\webpack\buildin\module.js

The key would be to identify how it ends up with long paths like ./100.78.116.21/volume-1-default/93ed3614bdcf632e2c04/7727d4897b44417fbda402e033601851/site/wwwroot/node_modules/webpack/buildin/module.js. Normally, these are not used.

@colltoaction
Copy link

I had the following in my ASP.NET Core project.json, the default from the aspnetcore-spa generator from https://github.com/aspnet/JavaScriptServices:

  "scripts": {
    "prepublish": [
      "npm install",
      "node node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js",
      "node node_modules/webpack/bin/webpack.js"
    ],
    "postpublish": [
      "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%"
    ]
  },

But I got a message saying it couldn't find the D:\home\site\repository\project_name\node_modules\webpack\bin\webpack.js file

Then I tried using a relative path but I get the following similar error messages as the OP:

    "prepublish": [
      "npm install",
      "node ../../wwwroot/node_modules/webpack/bin/webpack.js --config webpack.config.vendor.js",
      "node ../../wwwroot/node_modules/webpack/bin/webpack.js"
    ]
remote: ERROR in ./~/reflect-metadata/Reflect.js
remote: Module not found: Error: Cannot resolve module '\\100.73.42.52\volume-3-default\83adda8c6b8e88cbbf19\d04c72995f0b488d992cebde7a24a886\site\repository\RS.Web\node_modules\crypto-browserify\index.js' in D:\home\site\repository\RS.Web\node_modules\reflect-metadata
remote:  @ ./~/reflect-metadata/Reflect.js 840:35-52

These are probably two related issues, but if I fixed the issue we're discussing here I would at least be able to deploy.

@davidebbo
Copy link
Member

Is this with Node 6.2.2 or later? If so, it sounds related to http://stackoverflow.com/questions/38580186/issue-running-node-app-on-azure-app-service-with-engines-greater-than-6-0-0 and nodejs/node#7294

@colltoaction
Copy link

colltoaction commented Jul 28, 2016

Yes! It's working with 5.9.05.9.1 now :)

@jvano jvano closed this as completed Apr 29, 2024
@jvano
Copy link
Member

jvano commented Apr 29, 2024

Hi

If the problem persists and is related to running it on Azure App Service, please open a support incident in Azure:
https://learn.microsoft.com/en-us/azure/azure-portal/supportability/how-to-create-azure-support-request

This way we can better track and assist you on this case

Thanks,

Joaquin Vano
Azure App Service

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants