Aspnetcore-angular-universal: Call to Node module failed with error: Prerendering failed because of error

Created on 24 May 2017  ยท  26Comments  ยท  Source: TrilonIO/aspnetcore-angular-universal

I have cloned a fresh copy of repository, I ran it in visual studio 2017, after npm install, but when the project run it throw an exception with the following error message

Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Cannot find module "domain-context"

error3

when I refresh browser the error turn into the following error

Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Zone already loaded.
at E:\Projects\universal-4\Client\dist\main-server.js:64725:15

error run 2

Any Help will be really apreciated

question

Most helpful comment

Yes that worked. I was not aware that I would have to run build dev, Thanks for your help!! :)

All 26 comments

Do you have the latest Node installed? node --version to check.
If you can, wipe out your node_modules and do a fresh npm install (or yarn install, if you have yarn), something might of loaded wrong within VS2017 I'm thinking.

I have node 7.10, I will try wipe out, if not succeed I will try yarn
Thanks so much :)

Same error. I have node 6.9.4 installed. wiped out node_modules ERROR: Call to Node module failed with error: Prerendering failed because of error: Error: Cannot find Module

untitled

I tried yarn option but it seems it can't build modules or something goes wrong the following message appear to me in cmd

warning "[email protected]" has incorrect peer dependency "tslint@^5.0.0".
warning "[email protected]" has incorrect peer dependency "zone.js@^0.7.5".
[4/4] Building fresh packages...
[1/1] โ  node-sass: checking for Python executable "python" in the PATH
[-/1] โ ‚ waiting...
[-/1] โ ‚ waiting...
[-/1] โ ‚ waiting...
error E:\Projects\universal-4node_modules\node-sass: Command failed.
Exit code: 1
Command: C:\Windows\system32\cmd.exe
Arguments: /d /s /c node scripts/build.js
Directory: E:\Projects\universal-4node_modules\node-sass
Output:
Binary found at E:\Projects\universal-4node_modules\node-sass\vendor\win32-x64-51\binding.node
Testing binary
Binary has a problem: Error: %1 is not a valid Win32 application.
\?\E:\Projects\universal-4node_modules\node-sass\vendor\win32-x64-51\binding.node
at Object.Module._extensions..node (module.js:598:18)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at module.exports (E:\Projects\universal-4node_modules\node-sass\lib\binding.js:19:10)
at Object. (E:\Projects\universal-4node_modules\node-sass\lib\index.js:14:35)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
Building the binary locally
Building: C:\Program Files\nodejs\node.exe E:\Projects\universal-4node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\Program Files\nodejs\node.exe',
gyp verb cli 'E:\Projects\universal-4\node_modules\node-gyp\bin\node-gyp.js',
gyp verb cli 'rebuild',
gyp verb cli '--verbose',
gyp verb cli '--libsass_ext=',
gyp verb cli '--libsass_cflags=',
gyp verb cli '--libsass_ldflags=',
gyp verb cli '--libsass_library=' ]
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb which failed Error: not found: python2
gyp verb which failed at getNotFoundError (E:\Projects\universal-4node_moduleswhichwhich.js:13:12)
gyp verb which failed at F (E:\Projects\universal-4node_moduleswhichwhich.js:68:19)
gyp verb which failed at E (E:\Projects\universal-4node_moduleswhichwhich.js:80:29)
gyp verb which failed at E:\Projects\universal-4node_moduleswhichwhich.js:89:16
gyp verb which failed at E:\Projects\universal-4node_modules\isexe\index.js:42:5
gyp verb which failed at E:\Projects\universal-4node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:114:15)
gyp verb which failed python2 { Error: not found: python2
gyp verb which failed at getNotFoundError (E:\Projects\universal-4node_moduleswhichwhich.js:13:12)
gyp verb which failed at F (E:\Projects\universal-4node_moduleswhichwhich.js:68:19)
gyp verb which failed at E (E:\Projects\universal-4node_moduleswhichwhich.js:80:29)
gyp verb which failed at E:\Projects\universal-4node_moduleswhichwhich.js:89:16
gyp verb which failed at E:\Projects\universal-4node_modules\isexe\index.js:42:5
gyp verb which failed at E:\Projects\universal-4node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:114:15) code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb which failed Error: not found: python
gyp verb which failed at getNotFoundError (E:\Projects\universal-4node_moduleswhichwhich.js:13:12)
gyp verb which failed at F (E:\Projects\universal-4node_moduleswhichwhich.js:68:19)
gyp verb which failed at E (E:\Projects\universal-4node_moduleswhichwhich.js:80:29)
gyp verb which failed at E:\Projects\universal-4node_moduleswhichwhich.js:89:16
gyp verb which failed at E:\Projects\universal-4node_modules\isexe\index.js:42:5
gyp verb which failed at E:\Projects\universal-4node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:114:15)
gyp verb which failed python { Error: not found: python
gyp verb which failed at getNotFoundError (E:\Projects\universal-4node_moduleswhichwhich.js:13:12)
gyp verb which failed at F (E:\Projects\universal-4node_moduleswhichwhich.js:68:19)
gyp verb which failed at E (E:\Projects\universal-4node_moduleswhichwhich.js:80:29)
gyp verb which failed at E:\Projects\universal-4node_moduleswhichwhich.js:89:16
gyp verb which failed at E:\Projects\universal-4node_modules\isexe\index.js:42:5
gyp verb which failed at E:\Projects\universal-4node_modules\isexe\windows.js:36:5
gyp verb which failed at FSReqWrap.oncomplete (fs.js:114:15) code: 'ENOENT' }
gyp verb could not find "python". checking python launcher
gyp verb could not find "python". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack at PythonFinder.failNoPython (E:\Projects\universal-4node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack at PythonFinder. (E:\Projects\universal-4node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack at E:\Projects\universal-4node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack at FSReqWrap.oncomplete (fs.js:114:15)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\Program Files\nodejs\node.exe" "E:\Projects\universal-4\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd E:\Projects\universal-4node_modules\node-sass
gyp ERR! node -v v7.10.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok
Build failed with error code: 1
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

@donstarkey

Same error. I have node 6.9.4 installed. wiped out node_modules ERROR: Call to Node module failed with error: Prerendering failed because of error: Error: Cannot find Module main-server

Can you do an npm run build:dev to create the dist files needed to run everything? That takes care of that issue.

@alaatek
You might be running into the common node-sass issue:

https://github.com/MarkPieszak/aspnetcore-angular2-universal/issues/269#issuecomment-302469530

Might need an npm rebuild node-sass --force then npm i && npm run build:dev to rebuild everything. Let me know

Yes that worked. I was not aware that I would have to run build dev, Thanks for your help!! :)

npm run build:dev works but npm i && npm run build:dev is giving me an error:

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:dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild:dev', 'build:dev', 'postbuild:dev' ]
5 info lifecycle [email protected]~prebuild:dev: [email protected]
6 silly lifecycle [email protected]~prebuild:dev: no script for prebuild:dev, continuing
7 info lifecycle [email protected]~build:dev: [email protected]
8 verbose lifecycle [email protected]~build:dev: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~build:dev: PATH: <REMOVED>
10 verbose lifecycle [email protected]~build:dev: CWD: C:\MyProject
11 silly lifecycle [email protected]~build:dev: Args: [ '/d /s /c', 'webpack --progress --color' ]
12 silly lifecycle [email protected]~build:dev: Returned: code: 1  signal: null
13 info lifecycle [email protected]~build:dev: Failed to exec build:dev script
14 verbose stack Error: [email protected] build:dev: `webpack --progress --color`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:886:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd C:\MyProject
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build:dev"
19 error node v6.10.3
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error [email protected] build:dev: `webpack --progress --color`
22 error Exit status 1
23 error Failed at the [email protected] build:dev script 'webpack --progress --color'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the angular4-aspnetcore-universal package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     webpack --progress --color
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs angular4-aspnetcore-universal
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls angular4-aspnetcore-universal
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Can you add --verbose to the script within package.json for build:dev and try running it manually ? There must be some kind of compilation error that's happening. Is everything definitely installed properly? You could always wipe node_modules and reinstall to double check

@MarkPieszak I added --verbose here is the new npm-debug.log:

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:dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prebuild:dev', 'build:dev', 'postbuild:dev' ]
5 info lifecycle [email protected]~prebuild:dev: [email protected]
6 silly lifecycle [email protected]~prebuild:dev: no script for prebuild:dev, continuing
7 info lifecycle [email protected]~build:dev: [email protected]
8 verbose lifecycle [email protected]~build:dev: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~build:dev: PATH: <REMOVED>
10 verbose lifecycle [email protected]~build:dev: CWD: C:\MyProject
11 silly lifecycle [email protected]~build:dev: Args: [ '/d /s /c', 'webpack --progress --color --verbose' ]
12 silly lifecycle [email protected]~build:dev: Returned: code: 1  signal: null
13 info lifecycle [email protected]~build:dev: Failed to exec build:dev script
14 verbose stack Error: [email protected] build:dev: `webpack --progress --color --verbose`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:886:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid [email protected]
16 verbose cwd C:\MyProject
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build:dev"
19 error node v6.10.3
20 error npm  v3.10.10
21 error code ELIFECYCLE
22 error [email protected] build:dev: `webpack --progress --color --verbose`
22 error Exit status 1
23 error Failed at the [email protected] build:dev script 'webpack --progress --color --verbose'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the angular4-aspnetcore-universal package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     webpack --progress --color --verbose
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs angular4-aspnetcore-universal
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls angular4-aspnetcore-universal
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

@MarkPieszak Interesting, it looks like npm run build:dev fails now too:

C:\MyProject>npm run build:dev

> [email protected] build:dev C:\MyProject
> webpack --progress --color --verbose

'webpack' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "run" "build:dev"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! [email protected] build:dev: `webpack --progress
--color --verbose`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:dev script
'webpack --progress --color --verbose'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular4-aspnetcore-u
niversal package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack --progress --color --verbose
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs angular4-aspnetcore-universal
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls angular4-aspnetcore-universal
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\MyProject\npm-debug.l
og

I will try rebuilding node_modules as you suggested.

Looks like webpack isn't installed in node_modules, yup

@MarkPieszak Ok so I ditched npm and tried yarn install instead. So I made a new interesting discovery, if I open the project in VS2017 and run it with Ctrl+F5 I get this unhandled exception:

An unhandled exception occurred while processing the request.

Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Cannot find module 'C:\MyProject\Client\dist\main-server'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at findBootModule (C:\Users\AAAAAA\AppData\Local\Temp\tmp7DB5.tmp:111:17)
at findRenderToStringFunc (C:\Users\AAAAAA\AppData\Local\Temp\tmp7DB5.tmp:116:28)
at renderToStringImpl (C:\Users\AAAAAA\AppData\Local\Temp\tmp7DB5.tmp:75:51)
at C:\Users\AAAAAA\AppData\Local\Temp\tmp7DB6.tmp:113:19
at IncomingMessage.<anonymous> (C:\Users\AAAAAA\AppData\Local\Temp\tmp7DB6.tmp:132:38)
at emitNone (events.js:86:13)
Current directory is: C:\MyProject
Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance+<InvokeExportAsync>d__7.MoveNext()

_But_ if I open a cmd prompt in the project folder and execute dotnet run and visit the page it works! I'm not sure what's going on.

I tried running npm rebuild node-sass --force and npm i && npm run build:dev which succeeded this time but I am still getting the above error message.

If it can't find that file, that means webpack never finished building everything. Do you have the latest version of VS2017?

Yes, _Version 15.2 (26430.6)_

Make sure vs is using your PATH node version not the one that comes built in. Not sure why you're having these issues it seems like everything else is working for you though. Might just need to reboot the pc ?

So I tried it on another computer with fresh install of node.js and ASP.NET Core SDK and I'm getting the same kind of error:

fail: Microsoft.AspNetCore.Server.Kestrel[13]
      Connection id "0HL53O43CTH14": An unhandled exception was thrown by the application.
System.Exception: Call to Node module failed with error: Prerendering failed because of error: Error: Cannot find module 'C:\Users\Kyle\Source\Repos\aspnetcore-angular2-universal\Client\dist\main-server'
    at Function.Module._resolveFilename (module.js:469:15)
    at Function.Module._load (module.js:417:25)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at findBootModule (C:\Users\Kyle\AppData\Local\Temp\tmp762B.tmp:111:17)
    at findRenderToStringFunc (C:\Users\Kyle\AppData\Local\Temp\tmp762B.tmp:116:28)
    at renderToStringImpl (C:\Users\Kyle\AppData\Local\Temp\tmp762B.tmp:75:51)
    at C:\Users\Kyle\AppData\Local\Temp\tmp763C.tmp:113:19
    at IncomingMessage.<anonymous> (C:\Users\Kyle\AppData\Local\Temp\tmp763C.tmp:132:38)
    at emitNone (events.js:86:13)
Current directory is: C:\Users\Kyle\Source\Repos\aspnetcore-angular2-universal
   at Microsoft.AspNetCore.NodeServices.HostingModels.HttpNodeInstance.<InvokeExportAsync>d__7`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.NodeServices.HostingModels.OutOfProcessNodeInstance.<InvokeExportAsync>d__14`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.NodeServices.NodeServicesImpl.<InvokeExportWithPossibleRetryAsync>d__10`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()
   at AspCoreServer.Controllers.HomeController.<Index>d__0.MoveNext() in C:\Users\Kyle\Source\Repos\aspnetcore-angular2-universal\Server\Controllers\HomeController.cs:line 37
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeActionMethodAsync>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextActionFilterAsync>d__25.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeNextResourceFilter>d__22.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ResourceExecutedContext context)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)
   at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.<InvokeAsync>d__20.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Builder.RouterMiddleware.<Invoke>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Hosting.Internal.RequestServicesContainerMiddleware.<Invoke>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.AspNetCore.Server.Kestrel.Internal.Http.Frame`1.<RequestProcessingAsync>d__2.MoveNext()
info: Microsoft.AspNetCore.Hosting.Internal.WebHost[2]
      Request finished in 1720.0106ms 500

Ran npm rebuild node-sass --force and npm i && npm run build:dev and it didn't make a difference.

It seems likely that this might be more than a configuration issue.

Can you try node 7? Wondering if there's a bug with 6.10.3
Just did a fresh install as well and not seeing it ๐Ÿ˜“ @k-vekos

Can you make sure visual studio is using your Node Path?
img_0506

See $(PATH) ? Move that to the TOP

Previous issue that others ran into the same problem but rebuild node-sass etc worked for them: https://github.com/MarkPieszak/aspnetcore-angular2-universal/issues/254

Here's what I had configured:

I tried moving $(PATH) to the top and rebuilding, same error still. I'll try Node 7 next.

Installed Node v7.10.0, ran npm rebuild node-sass --force and npm i && npm run build:dev and now it works! I even moved $(PATH) back to its original place and it continues to work.

It must of been an issue with Node 6.10.3 perhaps, that's crazy. But I'm glad we figured it out!! ๐ŸŽ๐Ÿ‘๐Ÿ‘ @k-vekos Thanks for not giving up ๐Ÿ™ˆ

@k-vekos

I had a similar problem, related to the fact that wrong versions of Node.js and npm were used to compile (webpack) and serve the JS app, when initiated from Visual Studio 2017.

It appears that the $(VSINSTALLDIR)\Web\External (or ...\Web Tools\External in @MarkPieszak 's screenshot) path contains Visual Studio 2017's built-in (older) version of Node.js and npm.

The most important thing in Visual Studio 2017's Locations of external tools list is that Node's path (recent version) and the $(PATH) are _above_ the $(VSINSTALLDIR)\Web\External path and all VS-related ...\External paths.

error on npm rebuld node-sass --force

[cid:7181a65b-dcb3-4129-ab12-3aaaeb30ed62]

Any help greatly appreciated.

thanks,


From: Mark Pieszak notifications@github.com
Sent: Wednesday, May 24, 2017 1:35 PM
To: MarkPieszak/aspnetcore-angular2-universal
Cc: donstarkey; Mention
Subject: Re: [MarkPieszak/aspnetcore-angular2-universal] Call to Node module failed with error: Prerendering failed because of error (#279)

@donstarkeyhttps://github.com/donstarkey

Same error. I have node 6.9.4 installed. wiped out node_modules ERROR: Call to Node module failed with error: Prerendering failed because of error: Error: Cannot find Module main-server

Can you do an npm run build:dev to create the dist files needed to run everything? That takes care of that issue.

@alaatekhttps://github.com/alaatek
You might be running into the common node-sass issue:

269 (comment)https://github.com/MarkPieszak/aspnetcore-angular2-universal/issues/269#issuecomment-302469530

Might need an npm rebuild node-sass --force then npm i && npm run build:dev to rebuild everything. Let me know

โ€”
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHubhttps://github.com/MarkPieszak/aspnetcore-angular2-universal/issues/279#issuecomment-303813192, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AQBYCtSSRBAG8sUUy-XJftXauF-9JbaQks5r9HhvgaJpZM4NlHlm.

I ran into something similar with node-sass actually. I believe it kept complaining about missing python. Once I got python setup with the proper node path (VS vs node I installed globally), I was able to get the rebuild on node-sass working and webpack started working properly.

Interesting point on the path order. Wonder if changing that will fix the task runner? I always use developer command prompt to run npm run build:dev since task runner keeps failing with the node-sass error.

It should fix that yes, give it a shot and let us know!

Yea, it did work, nice to have npm and webpack runners working properly.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MarkPieszak picture MarkPieszak  ยท  14Comments

isaacrlevin picture isaacrlevin  ยท  24Comments

consigliory picture consigliory  ยท  17Comments

ketrex2 picture ketrex2  ยท  18Comments

borgotecnologia picture borgotecnologia  ยท  15Comments