mapbox / mapbox-gl-draw

Draw tools for mapbox-gl-js
https://www.mapbox.com/mapbox-gl-js/example/mapbox-gl-draw/
ISC License
942 stars 590 forks source link

npm install error #855

Closed SoftShit closed 4 years ago

SoftShit commented 5 years ago

I have lost a week of time trying to get this library to work. It appears to not be maintained. It fails when I do : $npm install

I want to know why. And also why there are 26 freaking deprecation messages. This project needs a tune up.

  1. $npm install

I posted this video.

$npm install doesn't.

It spews 26 deprecation messages, and then fails. Why 26 deprecated messages? Some dependencies showing deprecated messages are Mapbox owned libraries. Please update your crap.


npm WARN deprecated sinon@5.0.0: this version has been deprecated
npm WARN deprecated formatio@1.2.0: This package is unmaintained. Use @sinonjs/formatio instead
npm WARN deprecated samsam@1.3.0: This package has been deprecated in favour of @sinonjs/samsam
npm WARN deprecated text-encoding@0.6.4: no longer maintained
npm WARN deprecated shelf-pack@1.1.0: This module is now under the @mapbox namespace: install @mapbox/shelf-pack instead
npm WARN deprecated whoots-js@2.1.0: This module is now under the @mapbox namespace: install @mapbox/whoots-js instead
npm WARN deprecated feature-filter@2.2.0: This package has been merged into the 'mapbox-gl-style-spec' package
npm WARN deprecated point-geometry@0.0.0: This module has moved: please install @mapbox/point-geometry instead
npm WARN deprecated mapbox-gl-supported@1.2.0: This package has been moved to @mapbox/mapbox-gl-supported
npm WARN deprecated unitbezier@0.0.0: This module has moved: switch to @mapbox/unitbezier
npm WARN deprecated vector-tile@1.3.0: This module has moved: please install @mapbox/vector-tile instead
npm WARN deprecated nomnom@1.8.1: Package no longer supported. Contact support@npmjs.com for more info.
npm WARN deprecated circular-json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated geojson-area@0.1.0: This module is now under the @mapbox namespace: install @mapbox/geojson-area instead
npm WARN deprecated babel-preset-es2015@6.16.0: �  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/env to update!
npm WARN deprecated circular-json@0.3.1: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated ignore@3.2.0: several bugs fixed in v3.2.1
npm WARN deprecated is-my-json-valid@2.15.0: catastrophic backtracking in regexes could potentially lead to REDOS attack, upgrade to 2.17.2 as soon as possible
npm WARN deprecated domelementtype@1.3.0: update to domelementtype@1.3.1
npm WARN deprecated hoek@2.16.3: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated boom@2.10.1: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated cryptiles@2.0.5: This version is no longer maintained. Please upgrade to the latest version.
npm WARN deprecated node-uuid@1.4.7: Use uuid module instead
npm WARN deprecated formatio@1.1.1: This package is unmaintained. Use @sinonjs/formatio instead
npm WARN deprecated samsam@1.1.2: This package has been deprecated in favour of @sinonjs/samsam
npm WARN deprecated hoek@0.9.1: The major version is no longer supported. Please update to 4.x or newer
npm WARN deprecated clone@1.0.2: XSS vulnerability fixed in v1.0.3
npm ERR! code ETARGET
npm ERR! notarget No matching version found for gulp-sourcemaps@1.7.0
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'mapbox-gl-js-mock'
npm ERR! notarget

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\home\user\appdata\npm-cache\_logs\2019-01-10T19_04_41_465Z-debug.log
andrewharvey commented 5 years ago

With the introduction of https://github.com/mapbox/mapbox-gl-draw/commits/master/yarn.lock you should use yarn install instead of npm install to ensure you get the dependency versions set by yarn.lock.

I opened #856 to fix the instructions.

SoftShit commented 5 years ago

Thank you, we use yarn, would prefer to use yarn. When installing anything, I try the published installation instructions first (npm was listed), and later try to make it work with yarn.

I ran $yarn install and got more errors. If you could publish also that Node.js version 9 is the max version supported. I don't have Node version 9 on my system, but will go download and run again now.

I got this:

$yarn install
yarn install v1.12.3
[1/4] Resolving packages...
success Already up-to-date.
$ npm run build && npm run build-min
npm WARN npm npm does not support Node.js v11.6.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 4, 6, 7, 8, 9.
npm WARN npm You can find the latest version at https://nodejs.org/

> @mapbox/mapbox-gl-draw@1.1.1 build C:\home\mpi\repos\spike\maps\mapbox\apis\gl-js\gl-draw\mapbox-gl-draw
> NODE_ENV=production browserify index.js --standalone MapboxDraw > dist/mapbox-gl-draw-unminified.js

'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @mapbox/mapbox-gl-draw@1.1.1 build: `NODE_ENV=production browserify index.js --standalone MapboxDraw > dist/mapbox-gl-draw-unminified.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @mapbox/mapbox-gl-draw@1.1.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\home\user\appdata\npm-cache\_logs\2019-01-10T22_44_34_398Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
andrewharvey commented 5 years ago

Your yarn install worked, npm run build works for me with node v8.11.2.

'NODE_ENV' is not recognized as an internal or external command,

That looks like an issue specific to Windows, looks like it doesn't understand the shell script syntax for setting an environment variable. Sorry I can't help there, I don't use Windows.

SoftShit commented 5 years ago

Making progress, but $yarn install is still failing. I am using a Linux env on Windows for this (bash shell)

I rolled back to Node.js 9.11.2

Environment: Windows 10 Pro, with Cygwin (bash shell). The syntax should be recognized.

got this

$yarn install
yarn install v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.1: The platform "win32" is incompatible with this module.
info "fsevents@1.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
$ npm run build && npm run build-min

> @mapbox/mapbox-gl-draw@1.1.1 build C:\home\mpi\repos\spike\maps\mapbox\apis\gl-js\gl-draw\mapbox-gl-draw
> NODE_ENV=production browserify index.js --standalone MapboxDraw > dist/mapbox-gl-draw-unminified.js

'NODE_ENV' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @mapbox/mapbox-gl-draw@1.1.1 build: `NODE_ENV=production browserify index.js --standalone MapboxDraw > dist/mapbox-gl-draw-unminified.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @mapbox/mapbox-gl-draw@1.1.1 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\c\home\user\appdata\npm-cache\_logs\2019-01-10T22_52_49_258Z-debug.log
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
SoftShit commented 5 years ago

I am using cygwin on Windows, a Linux like environment that lets me run bash scripts. It should (bash) recognize the run target in package.json containing: NODE_ENV, but it is not, investigating.

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Thursday, January 10, 2019 3:51 PM, Andrew Harvey notifications@github.com wrote:

Your yarn install worked, npm run build works for me with node v8.11.2.

'NODE_ENV' is not recognized as an internal or external command,

That looks like an issue specific to Windows, looks like it doesn't understand the shell script syntax for setting an environment variable. Sorry I can't help there.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

SoftShit commented 5 years ago

There are several ways to get around this error when running on windows: 'NODE_ENV' is not recognized as an internal or external command,

Reference:

SoftShit commented 5 years ago

The easiest thing to do, even if you are using Cygwin bash on windows, is to install this, and you get a little further, at least past this error message. $yarn global add win-node-env

I am making a request to add that line to the readme.md instructions, a section : If you are running on Windows (and even if you are running a Cygwin bash shell), you will need to install this package to get this project to work: $yarn global add win-node-env

This will save hours of time and some head banging.

SoftShit commented 5 years ago

To summarize:

Please update the readme.md with three things

ahmedtauqeer commented 5 years ago

npm i -g npm@latest npm ERR! path C:\Users\admin'\AppData\Roaming\npm\node_modules.staging npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall unlink npm ERR! Error: EPERM: operation not permitted, unlink 'C:\Users\admin'\AppData\Roaming\npm\node_modules.staging' npm ERR! { [Error: EPERM: operation not permitted, unlink 'C:\Users\admin'\AppData\Roaming\npm\node_modules.staging'] npm ERR! stack: npm ERR! 'Error: EPERM: operation not permitted, unlink \'C:\Users\admin\'\AppData\Roaming\npm\node_modules\.staging\'', npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'unlink', npm ERR! path: npm ERR! 'C:\Users\admin\'\AppData\Roaming\npm\node_modules\.staging' } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It's possible that the file was already in use (by a text editor or antivirus), npm ERR! or that you lack permissions to access it. npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\admin'\AppData\Roaming\npm-cache_logs\2019-07-20T10_24_18_554Z-debug.log

awulkan commented 4 years ago

Another alternative is to switch out

NODE_ENV=production 

for

SET NODE_ENV=production && 

in the package.json file. It appears to be working on Windows, if you just want to edit it locally while developing. Of course this isn't a solution though, but you don't need any third party tools for it.

kkaefer commented 4 years ago

Upgraded to use yarn and Node 12