eleventy: Cannot find module 'viperhtml' (Error)

OS: macOS 10.14 Mojave node -v: v10.15.0 npm -v: 6.5.0 nvm --version: 0.34.0 @11ty/eleventy: 0.7.1

When I run eleventy I get

Problem writing Eleventy templates: (more in DEBUG output) Cannot find module ‘viperhtml’ (Error): Error: Cannot find module ‘viperhtml’ at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15) at Function.Module._load (internal/modules/cjs/loader.js:507:25) at Module.require (internal/modules/cjs/loader.js:637:17) at require (internal/modules/cjs/helpers.js:22:18) at Object.<anonymous> (/Users/me/mx41/blog/mx41.github.com/node_modules/@11ty/eleventy/test/stubs/viperhtml.11ty.js:1:81) at Module._compile (internal/modules/cjs/loader.js:689:30) at Object.Module._extensions…js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32) at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3)

Contents of package.json:

{ “name”: “mx41.github.com”, “version”: “1.0.0”, “description”: “”, “main”: “index.html”, “scripts”: { “start”: “eleventy --serve --watch”, “build”: “eleventy”, “test”: “echo "Error: no test specified" && exit 1” }, “repository”: { “type”: “git”, “url”: “git@github-mx41:mx41/mx41.github.com.git” }, “author”: “MX41”, “license”: “MIT”, “devDependencies”: { “@11ty/eleventy”: “^0.7.1” } }

I have tried npm install and removal of node_modules a few times, but it unfortunately did not help.

node is managed by nvm

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

Ah, okay. I think I know what happened now. I don’t think adding index.md did anything but adding node_modules into your .gitignore might have fixed it. If your .gitignore file was empty, eleventy may have been trying to process your node_modules (which had eleventy templates inside of it, including the viperhtml one).

Normally, if a project is missing a .gitignore file, we make it a special case to ignore node_modules but if your .gitignore was empty you’d run into this case.

We may need to make this special case smarter to check if .gitignore is empty or not.