Plugin "@netlify/plugin-functions-core" internal error: `Cannot find module`
See original GitHub issueHad to manually install node-fetch to fix below build fail.
Build was failing with below log:
7:57:56 PM: Build ready to start
7:57:57 PM: build-image version: 30f629161c0736b1a3ecd8b418e5eeffab5c0faf
7:57:57 PM: build-image tag: v3.3.14
7:57:57 PM: buildbot version: 1da4cf38e1ad1fe9ce7deeeba939bcc9c6c3f794
7:57:58 PM: Fetching cached dependencies
7:57:58 PM: Starting to download cache of 133.8MB
7:58:03 PM: Finished downloading cache in 5.174276912s
7:58:03 PM: Starting to extract cache
7:58:09 PM: Finished extracting cache in 6.307184998s
7:58:10 PM: Finished fetching cache in 11.534513859s
7:58:10 PM: Starting to prepare the repo for build
7:58:10 PM: Preparing Git Reference refs/heads/master
7:58:12 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'build' versus 'build/' in the Netlify UI
7:58:12 PM: Different functions path detected, going to use the one specified in the Netlify configuration file: 'functions' versus '' in the Netlify UI
7:58:12 PM: Creating functions prep folder
7:58:12 PM: Starting build script
7:58:12 PM: Installing dependencies
7:58:12 PM: Started restoring cached node version
7:58:16 PM: Finished restoring cached node version
7:58:17 PM: v10.20.1 is already installed.
7:58:18 PM: Now using node v10.20.1 (npm v6.14.4)
7:58:18 PM: Started restoring cached build plugins
7:58:18 PM: Finished restoring cached build plugins
7:58:18 PM: Attempting ruby version 2.6.2, read from environment
7:58:19 PM: Using ruby version 2.6.2
7:58:19 PM: Using PHP version 5.6
7:58:19 PM: 5.2 is already installed.
7:58:19 PM: Using Swift version 5.2
7:58:19 PM: Started restoring cached node modules
7:58:19 PM: Finished restoring cached node modules
7:58:19 PM: Started restoring cached yarn cache
7:58:19 PM: Finished restoring cached yarn cache
7:58:20 PM: Installing NPM modules using Yarn version 1.17.0
7:58:21 PM: yarn install v1.17.0
7:58:21 PM: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
7:58:21 PM: [1/4] Resolving packages...
7:58:23 PM: [2/4] Fetching packages...
7:58:42 PM: info fsevents@2.1.2: The platform "linux" is incompatible with this module.
7:58:42 PM: info "fsevents@2.1.2" is an optional dependency and failed compatibility check. Excluding it from installation.
7:58:42 PM: info fsevents@1.2.11: The platform "linux" is incompatible with this module.
7:58:42 PM: info "fsevents@1.2.11" is an optional dependency and failed compatibility check. Excluding it from installation.
7:58:42 PM: [3/4] Linking dependencies...
7:58:42 PM: warning " > @testing-library/user-event@7.2.1" has unmet peer dependency "@testing-library/dom@>=5".
7:58:42 PM: warning " > bootstrap@4.5.0" has unmet peer dependency "jquery@1.9.1 - 3".
7:58:42 PM: warning " > bootstrap@4.5.0" has unmet peer dependency "popper.js@^1.16.0".
7:58:42 PM: warning " > react-redux@7.2.0" has unmet peer dependency "redux@^2.0.0 || ^3.0.0 || ^4.0.0-0".
7:58:42 PM: warning "react-scripts > eslint-config-react-app@5.2.0" has incorrect peer dependency "eslint-plugin-flowtype@3.x".
7:58:42 PM: warning "react-scripts > @typescript-eslint/eslint-plugin > tsutils@3.17.1" has unmet peer dependency "typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta".
7:58:52 PM: [4/4] Building fresh packages...
7:58:54 PM: success Saved lockfile.
7:58:54 PM: Done in 33.45s.
7:58:54 PM: NPM modules installed using Yarn
7:58:55 PM: Started restoring cached go cache
7:58:55 PM: Finished restoring cached go cache
7:58:55 PM: go version go1.12 linux/amd64
7:58:55 PM: go version go1.12 linux/amd64
7:58:55 PM: Installing missing commands
7:58:55 PM: Verify run directory
7:58:57 PM: β
7:58:57 PM: βββββββββββββββββββββββββββββββ
7:58:57 PM: β Netlify Build β
7:58:57 PM: βββββββββββββββββββββββββββββββ
7:58:57 PM: β
7:58:57 PM: β― Version
7:58:57 PM: @netlify/build 1.0.10
7:58:57 PM: β
7:58:57 PM: β― Flags
7:58:57 PM: mode: buildbot
7:58:57 PM: β
7:58:57 PM: β― Current directory
7:58:57 PM: /opt/build/repo
7:58:57 PM: β
7:58:57 PM: β― Config file
7:58:57 PM: /opt/build/repo/netlify.toml
7:58:57 PM: β
7:58:57 PM: β― Context
7:58:57 PM: production
7:58:57 PM: β
7:58:57 PM: β― Loading plugins
7:58:57 PM: - @netlify/plugin-functions-core@1.0.10 from core
7:58:58 PM: β
7:58:58 PM: ββββββββββββββββββββββββββββββββββββββ
7:58:58 PM: β 1. build.command from netlify.toml β
7:58:58 PM: ββββββββββββββββββββββββββββββββββββββ
7:58:58 PM: β
7:58:58 PM: $ yarn build
7:58:58 PM:
7:58:58 PM:
7:58:58 PM: yarn run v1.17.0
7:58:58 PM:
7:58:58 PM: $ react-scripts build
7:59:00 PM: Creating an optimized production build...
7:59:27 PM: Compiled with warnings.
7:59:27 PM:
7:59:27 PM: ./src/components/molecules/dealerSelector/DealerSelector.js
7:59:27 PM: Line 1:17: 'useState' is defined but never used no-unused-vars
7:59:27 PM: ./src/api/utils.js
7:59:27 PM: Line 21:5: Unreachable code no-unreachable
7:59:27 PM: ./src/features/product/Product.js
7:59:27 PM: Line 2:8: 'isEmpty' is defined but never used no-unused-vars
7:59:27 PM: Line 7:8: 'car' is defined but never used no-unused-vars
7:59:27 PM: ./src/components/molecules/colors/Colors.js
7:59:27 PM: Line 3:8: 'Image' is defined but never used no-unused-vars
7:59:27 PM: Line 19:7: img elements must have an alt prop, either with meaningful text, or an empty string for decorative images jsx-a11y/alt-text
7:59:27 PM: Search for the keywords to learn more about each warning.
7:59:27 PM: To ignore, add // eslint-disable-next-line to the line before.
7:59:27 PM: File sizes after gzip:
7:59:27 PM: 84.6 KB build/static/js/2.4ccc8e2e.chunk.js
7:59:27 PM: 23.67 KB build/static/css/main.c8f91437.chunk.css
7:59:27 PM: 4.65 KB build/static/js/main.d99b92a9.chunk.js
7:59:27 PM: 771 B build/static/js/runtime-main.107bb8ca.js
7:59:27 PM: The project was built assuming it is hosted at /.
7:59:27 PM: You can control this with the homepage field in your package.json.
7:59:27 PM: The build folder is ready to be deployed.
7:59:27 PM: You may serve it with a static server:
7:59:27 PM: yarn global add serve
7:59:27 PM: serve -s build
7:59:27 PM: Find out more about deployment here:
7:59:27 PM: bit.ly/CRA-deploy
7:59:27 PM:
7:59:27 PM: Done in 29.03s.
7:59:27 PM: β
7:59:27 PM: (build.command completed in 29.3s)
7:59:27 PM: β
7:59:27 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:59:27 PM: β 2. onPostBuild command from @netlify/plugin-functions-core β
7:59:27 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:59:27 PM: β
7:59:27 PM: Packaging functions from functions
7:59:27 PM: β
7:59:27 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:59:27 PM: β Plugin "@netlify/plugin-functions-core" internal error β
7:59:27 PM: ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
7:59:27 PM: β
7:59:27 PM: Error message
7:59:27 PM: Error: In file "/opt/build/repo/functions/api-server/api-server.js": Cannot find module 'node-fetch'
7:59:27 PM: Require stack:
7:59:27 PM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it/src/resolve.js
7:59:27 PM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it/src/dependencies.js
7:59:27 PM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it/src/node.js
7:59:27 PM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it/src/main.js
7:59:27 PM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/netlify/src/deploy/hash-fns.js
7:59:27 PM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/netlify/src/deploy/index.js
7:59:27 PM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/netlify/src/index.js
7:59:27 PM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/api.js
7:59:27 PM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/load.js
7:59:27 PM: - /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/main.js
7:59:27 PM: β
7:59:27 PM: Plugin details
7:59:27 PM: Package: @netlify/plugin-functions-core
7:59:27 PM: Version: 1.0.10
7:59:27 PM: Repository: git+https://github.com/netlify/build.git
7:59:27 PM: npm link: https://www.npmjs.com/package/@netlify/build
7:59:27 PM: Report issues: https://github.com/netlify/build/issues
7:59:27 PM: β
7:59:27 PM: Error location
7:59:27 PM: In "onPostBuild" event in "@netlify/plugin-functions-core" from core
7:59:27 PM: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
7:59:27 PM: at Function.resolve (internal/modules/cjs/helpers.js:83:19)
7:59:27 PM: at resolvePathFollowSymlinks (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it/src/resolve.js:62:18)
7:59:27 PM: at resolvePackageFallback (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it/src/resolve.js:74:24)
7:59:27 PM: at resolvePackage (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/node_modules/@netlify/zip-it-and-ship-it/src/resolve.js:33:27)
7:59:27 PM: β
7:59:27 PM: Error properties
7:59:27 PM: { code: 'MODULE_NOT_FOUND' }
7:59:27 PM: β
7:59:27 PM: Resolved config
7:59:27 PM: build:
7:59:27 PM: command: yarn build
7:59:27 PM: functions: /opt/build/repo/functions
7:59:27 PM: publish: /opt/build/repo/build
7:59:27 PM: redirects:
7:59:27 PM: - from: /api/*
7:59:27 PM: headers:
7:59:27 PM: X-From: Netlify
7:59:27 PM: status: 200
7:59:27 PM: to: 'http://18.191.217.164/api_v1/:splat'
7:59:27 PM: - from: /*
7:59:27 PM: status: 200
7:59:27 PM: to: /index.html
7:59:28 PM: Caching artifacts
7:59:28 PM: Started saving node modules
7:59:28 PM: Finished saving node modules
7:59:28 PM: Started saving build plugins
7:59:28 PM: Finished saving build plugins
7:59:28 PM: Started saving yarn cache
7:59:28 PM: Finished saving yarn cache
7:59:28 PM: Started saving pip cache
7:59:28 PM: Finished saving pip cache
7:59:28 PM: Started saving emacs cask dependencies
7:59:28 PM: Finished saving emacs cask dependencies
7:59:28 PM: Started saving maven dependencies
7:59:28 PM: Finished saving maven dependencies
7:59:28 PM: Started saving boot dependencies
7:59:28 PM: Finished saving boot dependencies
7:59:28 PM: Started saving go dependencies
7:59:28 PM: Finished saving go dependencies
7:59:28 PM: Error running command: Build script returned non-zero exit code: 1
7:59:28 PM: Failing build: Failed to build site
7:59:28 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
7:59:28 PM: Finished processing build request in 1m30.718117209s
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Plugin "@netlify/plugin-functions-core" internal error - Support
Deploy failed due to an error in @netlify/plugin-functions-core plugin ... In file "/opt/build/repo/functions/image.js": Cannot find module ...
Read more >Deploy failed due to an error in @netlify/plugin-functions-core ...
Plugin β@netlify/plugin-functions-coreβ internal error. Error: In file β/opt/build/repo/api/dist/functions/graphql.jsβ: Cannot find module 'Β ...
Read more >cannot find module [Node npm Error Solved] - freeCodeCamp
In my case, I got it like this "Module not found: Error: Can't resolve 'react-icons/fa' in 'C:\Users\user\Desktop\Projects\Address Locator\Β ...
Read more >How do I resolve "Cannot find module" error using Node.js?
js located under home/dave/src/server/ ? If not and you want to use the module from any directory, you need to install it globally...
Read more >r/Tdarr - Reddit
Plugin error ! Error: Cannot find module '../methods/lib'. Setting up Tdarr for the first time with Docker. I have followed a video and...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Yes, absolutely @asimqt. You can opt-in to that automatic behavior using the
@netlify/plugin-functions-install-coreplugin as mentioned above.Hi @asimkt,
To automatically install Netlify Functions dependencies, please remove the
package.jsonfrom the Functions directory and add thedependenciesto your projectβs top-levelpackage.jsoninstead.The following alternative is also supported: adding the following to your
netlify.toml:However, beware that alternative:
npm install(oryarn) will be called twice instead of once.NPM_FLAGS,YARN_FLAGS,NPM_VERSIONandYARN_VERSIONenvironment variables.