Cannot find module @babel/preset-env and @babel/core
Closed this issue · 7 comments
calavera commented
Running this plugin locally with netlify-build run, I get this error:
┌───────────────────────────────────────────────────────┐
│ Plugin "@netlify/plugin-edge-handlers" internal error │
└───────────────────────────────────────────────────────┘
Error message
Error: Cannot find module '@babel/preset-env' from '/home/david/src/github.com/netlify/traffic-mesh/integration-test/site'
Plugin details
Package: @netlify/plugin-edge-handlers
Version: 1.0.0
npm link: https://www.npmjs.com/package/@netlify/plugin-edge-handlers
Error location
In "onPostBuild" event in "@netlify/plugin-edge-handlers" from netlify.toml and package.json
at Function.resolveSync [as sync] (/home/david/src/github.com/netlify/netlify-plugin-handler/node_modules/resolve/lib/sync.js:89:15)
at resolveStandardizedName (/home/david/src/github.com/netlify/netlify-plugin-handler/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
at resolvePreset (/home/david/src/github.com/netlify/netlify-plugin-handler/node_modules/@babel/core/lib/config/files/plugins.js:58:10)
at loadPreset (/home/david/src/github.com/netlify/netlify-plugin-handler/node_modules/@babel/core/lib/config/files/plugins.js:77:20)
at createDescriptor (/home/david/src/github.com/netlify/netlify-plugin-handler/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
at /home/david/src/github.com/netlify/netlify-plugin-handler/node_modules/@babel/core/lib/config/config-descriptors.js:109:50
at Array.map (<anonymous>)
at createDescriptors (/home/david/src/github.com/netlify/netlify-plugin-handler/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
at createPresetDescriptors (/home/david/src/github.com/netlify/netlify-plugin-handler/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
at /home/david/src/github.com/netlify/netlify-plugin-handler/node_modules/@babel/core/lib/config/config-descriptors.js:58:104
Error properties
{
code: 'PLUGIN_ERROR',
pluginCode: 'MODULE_NOT_FOUND',
plugin: 'babel',
hook: 'transform',
id: '/home/david/src/github.com/netlify/traffic-mesh/integration-test/site/edge-handlers/create-dependency.js',
watchFiles: [
'/home/david/src/github.com/netlify/traffic-mesh/integration-test/site/handlers-xwEPUC/__netlifyMain.ts',
'/home/david/src/github.com/netlify/traffic-mesh/integration-test/site/edge-handlers/create-dependency.js',
'/home/david/src/github.com/netlify/traffic-mesh/integration-test/site/edge-handlers/cache-app.js',
'/home/david/src/github.com/netlify/traffic-mesh/integration-test/site/edge-handlers/get-cache.js',
'/home/david/src/github.com/netlify/traffic-mesh/integration-test/site/edge-handlers/push-image.js',
'/home/david/src/github.com/netlify/traffic-mesh/integration-test/site/edge-handlers/set-cache.js',
'/home/david/src/github.com/netlify/traffic-mesh/integration-test/site/edge-handlers/smoke-response.js'
]
}
Resolved config
build:
base: /home/david/src/github.com/netlify/traffic-mesh/integration-test/site
functions: /home/david/src/github.com/netlify/traffic-mesh/integration-test/site/functions
publish: /home/david/src/github.com/netlify/traffic-mesh/integration-test/site
plugins:
- inputs: {}
origin: config
package: '@netlify/plugin-edge-handlers'
redirects:
- force: true
from: /sub/*
status: 200
to: index.html
- force: true
from: /redirect/relative
status: 301
to: some/other/page
- force: true
from: /rewrite-with-headers
headers:
X-From: Netlify
status: 200
to: /page2.html
- force: true
from: /api/hello
headers:
X-NF-Function-ID: test-function
status: 200
to: /.netlify/functions/hello
- edge_handler: push-image
from: /
status: 200
to: /
- edge_handler: set-cache
force: true
from: /set-cache
status: 200
to: index.html
- edge_handler: get-cache
force: true
from: /get-cache
status: 200
to: index.html
- edge_handler: cache-app
force: true
from: /cache-app
status: 200
to: index.html
calavera commented
It looks like @babel/preset-env and @babel/core need to be installed by anyone that wants to use this plugin on their project, which is very weird to me.
mraerino commented
those are specified as dependencies in the package.json so I'd expect them to be installed along with rollup etc?
mraerino commented
how did you install the plugin?
shortdiv commented
Yeah that's odd, it's listed as a dependency ^
calavera commented
how did you install the plugin?
I linked my local repo into my testing site.
mraerino commented
so you most likely need to run npm i in your local repo. that is done automatically once it's integrated