3

I am getthing this issue. I can't even build the Angular template using Dot Net Core/Standard 2.0

I just downloaded the Dotnet core 2.0 and VS 2017 15.3 and followed the wizard to just say hello world. I downloaded all the package needed from NPM source.

1>------ Rebuild All started: Project: AngularApplication2, Configuration: Debug Any CPU ------
1>AngularApplication2 -> c:\users\wil\documents\visual studio 2017\Projects\AngularApplication2\bin\Debug\netcoreapp2.0\AngularApplication2.dll
1>v4.6.0
1>Performing first-run Webpack build...
1>Hash: 803ac2b1a73d67da6627538031cacab98fa900ef
1>Version: webpack 2.5.1
1>Child
1>    Hash: 803ac2b1a73d67da6627
1>    Time: 5931ms
1>                                   Asset     Size  Chunks                    Chunk Names
1>    89889688147bd7575d6327160d64e760.svg   109 kB          [emitted]
1>                               vendor.js  3.26 MB       0  [emitted]  [big]  vendor
1>                              vendor.css   315 kB       0  [emitted]  [big]  vendor
1>Child
1>    Hash: 538031cacab98fa900ef
1>    Time: 5908ms
1>                                   Asset     Size  Chunks                    Chunk Names
1>    89889688147bd7575d6327160d64e760.svg   109 kB          [emitted]
1>                               vendor.js  3.43 MB       0  [emitted]  [big]  vendor
1>c:\users\wil\documents\visual studio 2017\Projects\AngularApplication2\node_modules\@ngtools\webpack\src\plugin.js:8
1>const { __NGTOOLS_PRIVATE_API_2 } = require('@angular/compiler-cli');
1>      ^
1>
1>SyntaxError: Unexpected token {
1>    at exports.runInThisContext (vm.js:53:16)
1>    at Module._compile (module.js:373:25)
1>    at Object.Module._extensions..js (module.js:416:10)
1>    at Module.load (module.js:343:32)
1>    at Function.Module._load (module.js:300:12)
1>    at Module.require (module.js:353:17)
1>    at require (internal/module.js:12:17)
1>    at Object.<anonymous> (c:\users\wil\documents\visual studio 2017\Projects\AngularApplication2\node_modules\@ngtools\webpack\src\index.js:30:10)
1>    at Module._compile (module.js:409:26)
1>    at Object.Module._extensions..js (module.js:416:10)
1>c:\users\wil\documents\visual studio 2017\Projects\AngularApplication2\AngularApplication2.csproj(34,5): error MSB3073: The command "node node_modules/webpack/bin/webpack.js" exited with code 1.
1>Done building project "AngularApplication2.csproj" -- FAILED.
========== Rebuild All: 0 succeeded, 1 failed, 0 skipped ==========

1

2 Answers 2

8

Its a issue with NodeJs Environment Variable,

Please install latest Node js from Official Website will resolve this environment variable setting problem and matches with same values as in latest Visual Studio.

Please rebuild your angular core project will resolve this issue.

Sign up to request clarification or add additional context in comments.

4 Comments

I have ` node --version v8.11.1` but I still have this problem publishing. Everything works just fine but when I publish I get and error. When I run the command stand-alone I get ERROR in main-client.js from UglifyJs Unexpected token: operator (>) [main-client.js:52912,19]
Please make sure you have no issues with npm packages dependencies (versions interdependent) in the packages listed in package.json. Check console for more error details and root cause.
The only console output error is from the VS Code terminal window where this is red .....csproj(41,5): error MSB3073: The command "node node_modules/webpack/bin/webpack.js --env.prod" exited with code 2.
Running the command in error was how I arrived at the "error detail" regarding 'main-client.js' which was also the only error.
5

Thanks to @Per ? I was missing path to the nodejs.

Tools -> Options -> Projects and Solutions -> Web Package management -> External Web Tools. Adding the path to nodejs install folder solved it.

2 Comments

Hi wil, do you mean to the nodejs executable or where the modules are installed?
Hi Matthew, I think it was a nodejs link like so "C:\Program Files (x86)\nodejs\" This was added to the Location of external tools

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.