Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webpack 2 build terminates with errors #47

Closed
embee8 opened this issue Feb 5, 2017 · 3 comments
Closed

Webpack 2 build terminates with errors #47

embee8 opened this issue Feb 5, 2017 · 3 comments

Comments

@embee8
Copy link

embee8 commented Feb 5, 2017

Installed product versions

  • Visual Studio: 2015 Community
  • This extension: 1.4.81

Description

I upgraded to Webpack 2 today and now the Webpack build throws an error when started through the NPM Task Runner.

Steps to recreate

Run either of the two defined scripts below through the NPM Task Runner for the following project structure / package versions.

{
  "dependencies": {
    "babel-plugin-react-css-modules": "^2.2.0",
    "react": "^15.4.2",
    "react-dom": "^15.4.2",
    "jquery": "3.1.1",
    "es6-promise": "^4.0.5"
  },
  "devDependencies": {
    "babel-core": "^6.22.1",
    "babel-loader": "^6.2.10",
    "babel-preset-es2015": "^6.22.0",
    "babel-preset-react": "^6.22.0",
    "css-loader": "0.26.1",
    "babel-plugin-transform-react-jsx": "^6.22.0",
    "extract-text-webpack-plugin": "2.0.0-rc.3",
    "style-loader": "0.13.1",
    "expose-loader": "^0.7.1",
    "webpack": "^2.2.1"
  },
  "scripts": {
    "webpack-watch": "webpack -w",
    "webpack-once": "webpack"
  }
}

Current behavior

This is the output I currently get:

webpack
Process terminated with code 1.
C:\Users\abc\Documents\Visual Studio 2015\Projects\abc\abc\node_modules\webpack\bin\webpack.js:186
outputOptions.children = options.map(o => o.stats);
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

If I start Webpack in a normal console window outside of the task runner it works fine. It looks like VS or this extension is using a different npm version?

Expected behavior

I am not sure whether this extension brings in its own external version of NPM or not. I would appreciate your insights.

@scottaddie
Copy link
Collaborator

VS 2015 ships with its own versions of Node and npm. Consequently, you'll want to tell VS to use the versions set on your system/user PATH environment variable. To do this, go to Tools --> Options --> Projects and Solutions --> External Web Tools, and move the $(PATH) entry to the 2nd position in the list. You should have something that looks like this:
external_web_tools

@embee8
Copy link
Author

embee8 commented Feb 5, 2017

Beautiful! I changed the order and the scripts now run again. Thank you for your swift reply, @scottaddie!

@embee8 embee8 closed this as completed Feb 5, 2017
@scbdhol
Copy link

scbdhol commented Feb 18, 2017

Great answer! Solved this issue for me too.

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

No branches or pull requests

3 participants