Unable to npm2rpm

Hi folks,

I am trying to upgrade foreman-packaging/rpm/develop, so it will use a newer version of patternfly-react (2.29.0) but having some troubles with it.

Even tho I did it a few times before with no problem, this time it refuses to work.

1. Installed npm2rpm

➜  foreman-packaging git:(rpm/develop) npm install -g npm2rpm
➜  foreman-packaging git:(rpm/develop) cat /home/asharvit/.nvm/versions/node/v10.15.0/lib/node_modules/npm2rpm/package.json | grep version
  "version": "3.1.0"

2. Try to create a bundled rpm:

➜  foreman-packaging git:(rpm/develop) ./add_npm_package.sh patternfly-react 2.29.0 bundle
Detected update...Making directory...rm 'packages/foreman/nodejs-patternfly-react/nodejs-patternfly-react.spec'
rm 'packages/foreman/nodejs-patternfly-react/patternfly-react-2.25.5.tgz'
FINISHED
Creating specs and downloading sources...---- npm2rpm ----
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
 - Starting npm module download: https://registry.npmjs.org/patternfly-react/-/patternfly-react-2.29.0.tgz
 - Unpacking in /tmp/npm2rpm-80821Y4QJmfKZbV4 ...
 - Finished extracting for patternfly-react
 - Reading package.json for patternfly-react
Warning: No README data
 - Finished reading package.json for patternfly-react
 - Fetching flattened list of production dependencies for patternfly-react
Callback must be a function
FINISHED
Copying specs...cp: cannot stat 'npm2rpm/SPECS/*': No such file or directory

3. Try to create a single rpm:

➜  foreman-packaging git:(rpm/develop) ./add_npm_package.sh patternfly-react 2.29.0 single
Detected update...Making directory...rm 'packages/foreman/nodejs-patternfly-react/nodejs-patternfly-react.spec'
rm 'packages/foreman/nodejs-patternfly-react/patternfly-react-2.25.5.tgz'
FINISHED
Creating specs and downloading sources...---- npm2rpm ----
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
 - Starting npm module download: https://registry.npmjs.org/patternfly-react/-/patternfly-react-2.29.0.tgz

 - Unpacking in /tmp/npm2rpm-8272ocTndxYzUrhe ...
 - Finished extracting for patternfly-react
 - Reading package.json for patternfly-react
Warning: No README data
 - Finished reading package.json for patternfly-react
fs.js:129
  throw new ERR_INVALID_CALLBACK();
  ^

TypeError [ERR_INVALID_CALLBACK]: Callback must be a function
    at maybeCallback (fs.js:129:9)
    at Object.writeFile (fs.js:1159:14)
    at writeSpecFile (/home/asharvit/.nvm/versions/node/v10.15.0/lib/node_modules/npm2rpm/bin/npm2rpm.js:87:6)
    at Extract.tar_extract.stream.on (/home/asharvit/.nvm/versions/node/v10.15.0/lib/node_modules/npm2rpm/bin/npm2rpm.js:78:5)
    at Extract.emit (events.js:187:15)
    at DirWriter.<anonymous> (/home/asharvit/.nvm/versions/node/v10.15.0/lib/node_modules/npm2rpm/node_modules/tar/lib/extract.js:81:8)
    at DirWriter.emit (events.js:187:15)
    at end (/home/asharvit/.nvm/versions/node/v10.15.0/lib/node_modules/npm2rpm/node_modules/fstream/lib/writer.js:324:14)
    at /home/asharvit/.nvm/versions/node/v10.15.0/lib/node_modules/npm2rpm/node_modules/fstream/lib/writer.js:314:34
    at endUtimes (/home/asharvit/.nvm/versions/node/v10.15.0/lib/node_modules/npm2rpm/node_modules/fstream/lib/writer.js:238:46)

Any help would be appreciated.
Thanks!

Try using an older node perhaps?

We actually rely on an unreleased version of npm2rpm. That version is compatible with the newest node and contains some more features. I need some help from @dLobatog to do an actual release but in the mean time please use the git version.

Works well with node v8.15.0, thanks @ohadlevy.

1 Like

@ekohl what do you mean by 'git version`? what is the git version? (master in github?)

Correct:

When using the git version I get this error:

➜  foreman-packaging git:(rpm/patternfly-react-2-29-0) ./add_npm_package.sh patternfly-react 2.29.0 single
Detected update...Making directory...rm 'packages/foreman/nodejs-patternfly-react/nodejs-patternfly-react.spec'
rm 'packages/foreman/nodejs-patternfly-react/patternfly-react-2.25.5.tgz'
FINISHED
Creating specs and downloading sources...---- npm2rpm ----
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
 - Undefined output directory - defaulting to npm2rpm
 - Starting npm module download: https://registry.npmjs.org/patternfly-react/-/patternfly-react-2.29.0.tgz
 - Unpacking in /tmp/npm2rpm-28057yppNBHC7JayG ...
 - Finished extracting for patternfly-react
 - Reading package.json for patternfly-react
Warning: No README data
 - Finished reading package.json for patternfly-react
FINISHED
Copying specs...cp: cannot stat 'npm2rpm/SPECS/*': No such file or directory

Getting the same error when using node-v10.15.0, node-v8.15.0 and node-v8.11.1.

Should have mentioned that the script also needs modifications to work with the newer version:

1 Like

With the help of @dLobatog I released npm2rpm 4.0 and merged the matching packaging PR. This also means all packagers that use npm2rpm must update their versions.