parcel-bundler / source-map

A fast source map manipulation, generation and consumption library written in Rust and Node.js
102 stars 14 forks source link

Installation failed (gyp) on Node 10.0.0 #48

Closed fregante closed 3 years ago

fregante commented 3 years ago

engines.node is set to ^10 in package.json, but source-map completely fails installation on Node 10.0.0

nvm 10.0.0
npm install @parcel/source-map@2.0.0-alpha.4.20
$ npm install @parcel/source-map@2.0.0-alpha.4.20

> @parcel/source-map@2.0.0-alpha.4.20 install /home/runner/work/GhostText/GhostText/node_modules/@parcel/source-map
> node-gyp-build

make: Entering directory '/home/runner/work/GhostText/GhostText/node_modules/@parcel/source-map/build'
  CC(target) Release/obj.target/nothing/../../node-addon-api/nothing.o
  AR(target) Release/obj.target/../../node-addon-api/nothing.a
  COPY Release/nothing.a
  CXX(target) Release/obj.target/sourcemap/src/napi/SourceMap.o
../src/napi/SourceMap.cpp: In member function ‘void SourceMapBinding::addIndexedMappings(const Napi::CallbackInfo&)’:
../src/napi/SourceMap.cpp:244:22: warning: unused variable ‘mappingIndex’ [-Wunused-variable]
         unsigned int mappingIndex = i / 6;
                      ^~~~~~~~~~~~
../src/napi/SourceMap.cpp: At global scope:
../src/napi/SourceMap.cpp:488:36: error: ISO C++ forbids declaration of ‘NAPI_MODULE_INIT’ with no type [-fpermissive]
 NAPI_MODULE_INIT(/* env, exports */) {
                                    ^
../src/napi/SourceMap.cpp: In function ‘int NAPI_MODULE_INIT()’:
../src/napi/SourceMap.cpp:489:35: error: ‘env’ was not declared in this scope
     return SourceMapBinding::Init(env, Napi::Object(env, exports));
                                   ^~~
../src/napi/SourceMap.cpp:489:35: note: suggested alternative: ‘ecvt’
     return SourceMapBinding::Init(env, Napi::Object(env, exports));
                                   ^~~
                                   ecvt
../src/napi/SourceMap.cpp:489:58: error: ‘exports’ was not declared in this scope
     return SourceMapBinding::Init(env, Napi::Object(env, exports));
                                                          ^~~~~~~
sourcemap.target.mk:115: recipe for target 'Release/obj.target/sourcemap/src/napi/SourceMap.o' failed
make: *** [Release/obj.target/sourcemap/src/napi/SourceMap.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/opt/hostedtoolcache/node/10.0.0/x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:225:12)
gyp ERR! System Linux 5.4.0-1039-azure
gyp ERR! command "/opt/hostedtoolcache/node/10.0.0/x64/bin/node" "/opt/hostedtoolcache/node/10.0.0/x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/runner/work/GhostText/GhostText/node_modules/@parcel/source-map
gyp ERR! node -v v10.0.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 

Demo GitHub Actions workflow and its result: https://github.com/GhostText/GhostText/blob/ee65fe32995a20e40283fa4afeb543e95747d6b6/.github/workflows/ci.yml#L11 https://github.com/GhostText/GhostText/runs/1834108086?check_suite_focus=true

mischnic commented 3 years ago

We actually switched to "node": ">= 12.0.0" for Parcel itself anyway....

fregante commented 3 years ago

Strangely no notice appears about that when installing parcel@nightly on v10:

https://github.com/GhostText/GhostText/runs/1834210206?check_suite_focus=true

mischnic commented 3 years ago

Maybe the npm version is too old. Or the npm log level is set too low?

Is there a reason you're using Node 10?

fregante commented 3 years ago

Is there a reason you're using Node 10?

No, I sent an extension to Mozilla Addons and they tried to build it on exactly 10.0.0. The issue doesn't affect me directly but thought it might be easily solved (either by fixing the build or bumping the engines key)