pnp / sp-dev-fx-vs-extension

Visual Studio extension work around SPFx together with community
MIT License
56 stars 25 forks source link

Need to install npm everytime new project is created & run for the first time (per project) #29

Closed jaiswati closed 5 years ago

jaiswati commented 6 years ago

Versions

[ ] Visual Studio version : Visual Studio 2017 Community/Enterprise 2017
[ ] SPFx Generator version latest version

Expected or Desired Behavior

SPFx Visual Studio Project should launch Workbench without the need to install npm everytime new project is created & when we try to run the project for the first time.

Observed Behavior

Hi Vesa,

We have installed latest SPFx Visual Studio Template for visual studio 2017 (as described above 1.4.0 latest) but when we run the project to launch the workbench..

We need to install gulp everytime the new project is created.. like npm install gulp

after it is done we need to fix Error: Cannot find module '@ microsoft/sp-build-web'

after this is fixed we get the error Error: listen EADDRINUSE

so after all command prompt instances are closed above error goes away..

How to avoid these errors

Error Log as follow C:\Users\jaiswati\Documents\Visual Studio 2017\Projects\MyWebPart5\MyWebPart5>gulp package-solution [10:11:40] Local gulp not found in ~\Documents\Visual Studio 2017\Projects\MyWebPart5\MyWebPart5 [10:11:40] Try running: npm install gulp

C:\Users\jaiswati\Documents\Visual Studio 2017\Projects\MyWebPart5\MyWebPart5>install gulp 'install' is not recognized as an internal or external command, operable program or batch file.

C:\Users\jaiswati\Documents\Visual Studio 2017\Projects\MyWebPart5\MyWebPart5>npm install gulp npm WARN deprecated gulp-util@3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5 npm WARN deprecated graceful-fs@3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated graceful-fs@1.2.3: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js npm notice created a lockfile as package-lock.json. You should commit this file.

gulp@3.9.1 added 270 packages in 35.049s C:\Users\jaiswati\Documents\Visual Studio 2017\Projects\MyWebPart5\MyWebPart5>gulp package-solution module.js:549 throw err; ^

Error: Cannot find module '@ microsoft/sp-build-web' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (C:\Users\jaiswati\Documents\Visual Studio 2017\Projects\MyWebPart5\MyWebPart5\gulpfile.js:4:15) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3)

C:\Users\jaiswati\Documents\Visual Studio 2017\Projects\MyWebPart5\MyWebPart5>npm install --save-dev

eshupps commented 6 years ago

Most likely, you already have Node tools for Visual Studio installed and it's trying to use the wrong version. The SPFx Yeoman generator requires a more recent version than the one installed by default in VS. We have documented the workaround for this here:

https://github.com/SharePoint/sp-dev-fx-vs-extension/wiki/Node-tools-in-Visual-Studio-2017

jaiswati commented 6 years ago

**still getting this error https://imagebin.ca/v/3vAV14pVta1i

Error: Cannot find module '@ microsoft/sp-build-web' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (C:\Users\jaiswati\Documents\Visual Studio 2017\Projects\MyWebPart5\MyWebPart5\gulpfile.js:4:15) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3)