简体   繁体   中英

Can't install gulp

When I want to reinstall my developer environment, I have some issues with gulp.

npm install gulp-cli -g
npm : npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
At line:1 char:1
+ npm install gulp-cli -g
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (npm WARN deprec...-url#deprecated:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

I have tried to install different Node version with NVM and I have this issue on all the node versions.

nvm list

    14.15.0
    14.6.0
    12.13.1
    12.13.0

Is there a way to resolve this issue, so I could have an SPFX developer environment again?

As stated above, what you are showing is a deprecation warning, so gulp-cli should be installed. Use the following to see if gulp-cli is installed:

npm ls -g --depth=0

which should report the version of gulp-cli.

You can also run

gulp -v

This will return the "CLI version:" and "Local version:" of gulp. The local version will be listed as Unknown unless your are in the folder with a SPFx project where "npm i" has been run, where Gulp commands will also be available (gulp build, gulp serve, etc.)

Hope this helps.

After further investigation, I figured out that gulp wasn't installed because of an error with NVM.

NVM wasn't showing which version I was using, and also not changing the version.

To fix this

I had to delete the folder located at C:\Program Files\nodejs

And then run NVM use {version} Install gulp-cli again and now Gulp is installed

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM