Hi.
I am trying to use netlify-plugin-cache-folder
as my plugins.
[[plugins]]
package = "netlify-plugin-cache-folder"
[build.environment]
# bypass npm auto install
NPM_FLAGS = "--version"
"markdown-it-footnote": "^3.0.3",
"netlify-plugin-cache-folder": "^0.0.8",
"node-fetch": "~2.6.7",
"npm-run-all": "^4.1.5",
The package is already declared in package.json
and netlify.toml
, I also change the .gitignore
of my Eleventy according to this Eleventy on Netlify | Netlify Docs
node_modules/
**/node_modules/**
dist/
.parcel-cache/
But still no luck
10:37:12 PM: ❯ Config file
10:37:12 PM: /opt/build/repo/netlify.toml
10:37:12 PM:
10:37:12 PM: ❯ Context
10:37:12 PM: deploy-preview
10:37:12 PM:
10:37:12 PM: ────────────────────────────────────────────────────────────────
10:37:12 PM: Configuration error
10:37:12 PM: ────────────────────────────────────────────────────────────────
10:37:12 PM:
10:37:12 PM: Error message
10:37:12 PM: Plugins must be installed either in the Netlify App or in "package.json".
10:37:12 PM: Please run "npm install -D netlify-plugin-cache-folder" or "yarn add -D netlify-plugin-cache-folder".
10:37:12 PM:
10:37:12 PM: Resolved config
10:37:12 PM: build:
10:37:12 PM: command: npx pnpm i --store=node_modules/.pnpm-store && npx pnpm run build
10:37:12 PM: commandOrigin: config
10:37:12 PM: environment:
10:37:12 PM: - REVIEW_ID
10:37:12 PM: - WEBMENTION_IO_TOKEN
10:37:12 PM: - NPM_FLAGS
10:37:12 PM: - NODE_VERSION
10:37:12 PM: publish: /opt/build/repo/dist
10:37:12 PM: publishOrigin: config
10:37:12 PM: plugins:
10:37:12 PM: - inputs: {}
10:37:12 PM: origin: config
10:37:12 PM: package: netlify-plugin-cache-folder
10:37:13 PM: Caching artifacts
10:37:13 PM: Started saving node modules
My site is:
Full netlify.toml
:
[[plugins]]
package = "netlify-plugin-cache-folder"
[build.environment]
# bypass npm auto install
NPM_FLAGS = "--version"
NODE_VERSION = "16"
[build]
publish = "dist"
command = "npx pnpm i --store=node_modules/.pnpm-store && npx pnpm run build"
I have tried to change the order or the tag
, moving plugin
to the bottom of the file. No luck.
Thanks.
Melvin
August 29, 2022, 1:03pm
3
Hi @azzamsa ,
Thanks for reaching out!
Did you run npm install -D netlify-plugin-cache-folder
or yarn add -D netlify-plugin-cache-folder
initially?
I did find this forum post with a similar issue. Do any of the solutions work for you?
Did you run npm install -D netlify-plugin-cache-folder or yarn add -D netlify-plugin-cache-folder initially?
I did this locally, but not in netlify.toml
.
All my dependencies located in package.json
is installed during build. The "netlify-plugin-cache-folder": "^0.0.8",
is already in package.json
.
But, during the build it is not installed.
I did find this forum post with a similar issue. Do any of the solutions work for you?
The solution here is to add the plugin into package.json
, which I did before reporting this issue.
Any other suggestions?
Thanks!
Hello @azzamsa !
I noticed you are using pnpm
, have you seen this thread before?
One suggestion in that thread is when using pnpm
is to use this pnpm preinstaller plugin .
If you were to use the plugin, first install the plugin then add it as an addition plugin in your netlify.toml file like so:
[[plugins]]
package = "./plugins/pnpm-preinstaller"
[[plugins]]
package = "netlify-plugin-cache-folder"
I was able to reproduce your netlify-plugin-cache-folder
error by using pnpm and the pnpm preinstaller plugin solved the issue.
Let us know if that was helpful!
Hi.
I tried you solution but no luck.
4:40:50 AM: ────────────────────────────────────────────────────────────────
4:40:50 AM: Configuration error
4:40:50 AM: ────────────────────────────────────────────────────────────────
4:40:50 AM:
4:40:50 AM: Error message
4:40:50 AM: Plugin could not be found using local path: ./plugins/pnpm-preinstaller
4:40:50 AM: Cannot find module './plugins/pnpm-preinstaller'
4:40:50 AM: Require stack:
4:40:50 AM: - /opt/buildhome/node-deps/node_modules/@netlify/build/src/utils/resolve.js
4:40:50 AM:
4:40:50 AM: Resolved config
4:40:50 AM: build:
4:40:50 AM: command: npx pnpm i --store=node_modules/.pnpm-store && npx pnpm run build
4:40:50 AM: commandOrigin: config
4:40:50 AM: environment:
4:40:50 AM: - REVIEW_ID
4:40:50 AM: - WEBMENTION_IO_TOKEN
4:40:50 AM: - NPM_FLAGS
4:40:50 AM: - NODE_VERSION
4:40:50 AM: publish: /opt/build/repo/dist
4:40:50 AM: publishOrigin: config
4:40:50 AM: plugins:
4:40:50 AM: - inputs: {}
4:40:50 AM: origin: config
4:40:50 AM: package: ./plugins/pnpm-preinstaller
4:40:50 AM: - inputs: {}
4:40:50 AM: origin: config
4:40:50 AM: package: netlify-plugin-cache-folder
4:40:50 AM: Caching artifacts
netlify.toml
[[plugins]]
package = "./plugins/pnpm-preinstaller"
[[plugins]]
package = "netlify-plugin-cache-folder"
[build.environment]
# bypass npm auto install
NPM_FLAGS = "--version"
NODE_VERSION = "16"
[build]
publish = "dist"
command = "npx pnpm i --store=node_modules/.pnpm-store && npx pnpm run build"
package.json
"markdown-it-anchor": "^8.6.4",
"markdown-it-footnote": "^3.0.3",
+ "netlify-plugin-cache-folder": "^0.0.8",
+ "netlify-plugin-pnpm-preinstaller": "^0.0.4",
"node-fetch": "~2.6.7",
"npm-run-all": "^4.1.5",
.gititnore
modified .gitignore
@@ -1,4 +1,4 @@
-node_modules/
+**/node_modules/**
I tried to revert the gitignore file to node_modules/
instead of **/node_modules/**
. No luck. I also tried to “clear cache and retry deploy”. No luck too.
Melvin
September 1, 2022, 3:18pm
10
Hi @azzamsa ,
Thanks for trying out the suggestions and letting us know your results.
Would it be possible for you to install the pnpm plugin locally instead of from npm. It appears from the netlify.toml
provided that npm is not installing any node modules.
Another option would be to copy the netlify-plugin-cache-folder
plugin into your repository.
You could also then change the build command in your netlify.toml
to just npx pnpm run build
.
Let us know if that doesn’t work for you.
azzamsa
September 4, 2022, 3:52am
11
After so much time wasted. I just give up and use npm
instead of pnpm
.
I hope pnpm
support will be better in the future.