parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.48k stars 2.27k forks source link

parcel@next install fails: source-map: Command failed. #4426

Closed MarkLyck closed 4 years ago

MarkLyck commented 4 years ago

🐛 bug report

Cannot install the latest @next version of parcel.

parcel@2.0.0-alpha.3.2

an error occurs in the source-map script.

🤔 Expected Behavior

parcel should install

😯 Current Behavior

yarn add parcel@2.0.0-alpha.3.2 fails npm install parcel@2.0.0-alpha.3.2 fails

🔦 Context

LOG:

yarn global add parcel@next    
yarn global v1.17.3
[1/4] 🔍  Resolving packages...
warning npm > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning npm > node-gyp > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning npx > npm > request@2.81.0: request has been deprecated, see https://github.com/request/request/issues/3142
warning npx > npm > node-gyp > request@2.81.0: request has been deprecated, see https://github.com/request/request/issues/3142
warning npx > npm > pacote > make-fetch-happen > socks-proxy-agent > socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
warning npx > npm > npm-registry-client > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning npx > npm > request > hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
warning npx > npm > request > hawk > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning npx > npm > request > hawk > sntp@1.0.9: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
warning npx > npm > request > hawk > sntp > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning npx > npm > request > hawk > boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning npx > npm > request > hawk > boom > hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning npx > npm > request > hawk > cryptiles@2.0.5: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning npx > npm > request > hawk > cryptiles > boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features, bug fixes, and security patches. If you are unable to upgrade at this time, paid support is available for older versions (hapi.im/commercial).
warning parcel > @parcel/config-default > @parcel/optimizer-htmlnano > htmlnano > uncss > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning parcel > @parcel/config-default > @parcel/optimizer-htmlnano > htmlnano > uncss > jsdom > request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
warning parcel > @parcel/config-default > @parcel/reporter-dev-server > http-proxy-middleware > micromatch > snapdragon > source-map-resolve > urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
warning parcel > @parcel/config-default > @parcel/reporter-dev-server > http-proxy-middleware > micromatch > snapdragon > source-map-resolve > resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
[2/4] 🚚  Fetching packages...
warning @parcel/namer-default@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/optimizer-htmlnano@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/packager-css@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/optimizer-cssnano@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/bundler-default@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/optimizer-terser@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/packager-raw@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/packager-html@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/packager-js@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/reporter-bundle-analyzer@2.0.0-nightly.1818: The engine "parcel" appears to be invalid.
warning @parcel/reporter-cli@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/packager-ts@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/reporter-dev-server@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/resolver-default@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/runtime-js@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/runtime-react-refresh@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/runtime-browser-hmr@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-coffeescript@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-babel@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-graphql@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-html@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-css@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-json@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/optimizer-data-url@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-inline-string@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-js@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-mdx@2.0.0-nightly.1818: The engine "parcel" appears to be invalid.
warning @parcel/transformer-less@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-postcss@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-raw@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-posthtml@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-stylus@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-react-refresh-babel@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-sass@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-react-refresh-wrap@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-pug@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-sugarss@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-typescript-types@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-toml@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
warning @parcel/transformer-yaml@2.0.0-nightly.196: The engine "parcel" appears to be invalid.
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
[-/5] ⢀ waiting...
[2/5] ⢀ @parcel/source-map
[-/5] ⢀ waiting...
[-/5] ⢀ waiting...
error /Users/xxx/.config/yarn/global/node_modules/@parcel/source-map: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: /Users/xxx/.config/yarn/global/node_modules/@parcel/source-map
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@5.0.5
gyp info using node@12.12.0 | darwin | x64
gyp info find Python using Python version 2.7.16 found at "/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python"
gyp info spawn /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
gyp info spawn args [
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/xxx/.config/yarn/global/node_modules/@parcel/source-map/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/xxx/Library/Caches/node-gyp/12.12.0/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/xxx/Library/Caches/node-gyp/12.12.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/xxx/Library/Caches/node-gyp/12.12.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/xxx/.config/yarn/global/node_modules/@parcel/source-map',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/nothing/node_modules/node-addon-api/src/nothing.o
  LIBTOOL-STATIC Release/nothing.a
Traceback (most recent call last):
  File "./gyp-mac-tool", line 611, in <module>
    sys.exit(main(sys.argv[1:]))
  File "./gyp-mac-tool", line 30, in main
    exit_code = executor.Dispatch(args)
  File "./gyp-mac-tool", line 45, in Dispatch
    return getattr(self, method)(*args[1:])
  File "./gyp-mac-tool", line 248, in ExecFilterLibtool
    if not libtool_re.match(line) and not libtool_re5.match(line):
TypeError: cannot use a string pattern on a bytes-like object
make: *** [Release/nothing.a] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/xxx/.config/yarn/global/node_modules/@parcel/source-map

🌍 Your Environment

yarn global v1.17.3

DeMoorJasper commented 4 years ago

Not entirely sure why this fails it should come with prebuilds. Especially on Mac OS X. It might be trying to install an old version?

Unless you're running 32-bit it should be there: https://unpkg.com/browse/@parcel/source-map@2.0.0-alpha.4.6/prebuilds/darwin-x64/

MarkLyck commented 4 years ago

I'm on MacOS Catalina 10.15.3

I do see the prebuilds in my node_modules as well.

mischnic commented 4 years ago

~(The node-gyp error seems to be related to Python 2/3, somehow only Python 2 is supported?) https://github.com/atom/git-utils/issues/72#issuecomment-263755735~

Python 2 indeed being used...

DeMoorJasper commented 4 years ago

@mischnic any clue why it's even running node-gyp rebuild in the first place?

mischnic commented 4 years ago

No.

@MarkLyck

MarkLyck commented 4 years ago

@mischnic

mischnic commented 4 years ago

@DeMoorJasper No idea

aarjithn commented 4 years ago

Running into this error in windows because it is looking for python. Is python a dependency to install parcel2?

error C:\Users\user\code\parcelv2\node_modules\@parcel\source-map: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments:
Directory: C:\Users\user\code\parcelv2\node_modules\@parcel\source-map
Output:
C:\Users\user\code\parcelv2\node_modules\@parcel\source-map>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using node-gyp@3.8.0
gyp info using node@10.16.0 | win32 | x64
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js:282:31
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\user\code\parcelv2\node_modules\@parcel\source-map
gyp ERR! node -v v10.16.0
DeMoorJasper commented 4 years ago

@aarjithn it is for building native node modules using node-gyp but that should not be necessary on windows, mac, linux and alpine linux. I have no clue why it is even running node-gyp in the first place especially rebuild, it should just detect a prebuild and use that

aarjithn commented 4 years ago

Thanks @DeMoorJasper, makes sense.

I can confirm /node_modules/@parcel/source-map/prebuilds/win32-x64/node.napi.glibc.node is present, also running yarn node-gyp-build-test says Done in 0.31s.

(Previously I ran the command incorrectly. Have edited comment to avoid confusion, thanks again @DeMoorJasper

DeMoorJasper commented 4 years ago

@aarjithn I think you ran that command in your project and not inside the folder where source-map has been installed. You should run that command in <your project directory>/node_modules/@parcel/source-map

mischnic commented 4 years ago

This is the package.json of @parcel/source-map@2.0.0-alpha.4.7 that npm installs: There is a "install": "node-gyp rebuild" script that we did not specify

{
  // ...
  "license": "MIT",
  "main": "./dist/node.js",
  "name": "@parcel/source-map",
  "scripts": {
    "benchmark": "npm run benchmark:node && npm run benchmark:wasm",
    "benchmark:node": "cross-env BACKEND=node node ./bench/run",
    "benchmark:wasm": "cross-env BACKEND=wasm node ./bench/run",
    "build:dev": "node-gyp rebuild --debug",
    "compile-wasm": "make",
    "install": "node-gyp rebuild", /// <<-------- where does this come from?
    "lint": "prettier --write src/*.js",
    "postinstall": "node-gyp-build",
    "prebuild": "prebuildify --napi --strip --tag-libc",
    "prepublish": "npm run transpile",
    "rebuild": "rm -rf build && yarn build:dev",
    "test": "npm run test:node && npm run test:wasm",
    "test:node": "cross-env BACKEND=node mocha ./test/*.test.js",
    "test:wasm": "cross-env BACKEND=wasm mocha ./test/*.test.js",
    "transpile": "babel ./src/*.js --out-dir ./dist && flow-copy-source -v src dist",
    "typecheck": "flow"
  },
  "version": "2.0.0-alpha.4.7"
}

Compare to: https://unpkg.com/browse/@parcel/source-map@2.0.0-alpha.4.7/package.json

Great, npm adds this as a default value: https://docs.npmjs.com/misc/scripts#default-values

DeMoorJasper commented 4 years ago

@mischnic wow that's strange, npm shouldn't be modifying anything to a deploy... anyway great discovery will merge your PR and close of this issue :)

mischnic commented 4 years ago

npm shouldn't be modifying anything to a deploy

(This happens during npm install)