ahmadawais/create-guten-block

Cannot find module '/root/.npm/_npx/87162/lib/node_modules/create-guten-block/node_modules/@scarf/scarf/report.js'

electricmessiah opened this issue · 1 comments

I've tried a few different approaches, but the initial startup is failing. So many (82) issues and hasn't been updated in months. What is this garbage?

 sudo npx create-guten-block my-block
internal/modules/cjs/loader.js:638
    throw err;
    ^
 
Error: Cannot find module '/root/.npm/_npx/87162/lib/node_modules/create-guten-block/node_modules/@scarf/scarf/report.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:623:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @scarf/scarf@1.1.0 postinstall: `node ./report.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @scarf/scarf@1.1.0 postinstall 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!     /root/.npm/_logs/2021-01-26T02_40_50_087Z-debug.log
Install for create-guten-block@latest failed with code 1

I'm having this same problem using nvm in Docker. It seems to affect (at least) node versions 9, 10, and 14.

Here is my Dockerfile:

FROM wordpress:latest

VOLUME /var/www/html
WORKDIR /var/www/html

EXPOSE 80/tcp

# Install NVM and NodeJS v14
ENV NVM_DIR=/usr/local/nvm
RUN install -d $NVM_DIR && curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
ENV NODE_VERSION v14.17.4
RUN /bin/bash -c "source $NVM_DIR/nvm.sh && nvm install $NODE_VERSION && nvm use --delete-prefix $NODE_VERSION"

ENV NODE_PATH $NVM_DIR/versions/node/$NODE_VERSION/lib/node_modules
ENV PATH      $NVM_DIR/versions/node/$NODE_VERSION/bin:$PATH

# Start Apache
CMD ["apache2-foreground"]

Then when I run the command to create a new block:

root@06d9bbae399d:/var/www/html/wp-content/plugins# npx create-guten-block my-block
internal/modules/cjs/loader.js:892
  throw err;
  ^

Error: Cannot find module '/root/.npm/_npx/196/lib/node_modules/create-guten-block/node_modules/@scarf/scarf/report.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @scarf/scarf@1.1.1 postinstall: `node ./report.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the @scarf/scarf@1.1.1 postinstall 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!     /root/.npm/_logs/2021-08-09T16_44_18_809Z-debug.log
Install for [ 'create-guten-block@latest' ] failed with code 1