Docusaurus build fails with "sharp" module issue - build

Upon yarn build my projects fails to build. I've tried recommended options, but nothing works and error returns every-time. The project works upon using yarn start, just the build doesn't work
[ERROR] Unable to build website for locale en.
[ERROR] Error:
Something went wrong installing the "sharp" module
Cannot find module '../build/Release/sharp-darwin-x64.node'
Require stack:
- /Users/.../node_modules/sharp/lib/sharp.js
- /Users/.../node_modules/sharp/lib/constructor.js
- /Users/.../node_modules/sharp/lib/index.js
- /Users/.../node_modules/#docusaurus/responsive-loader/lib/adapters/sharp.js
- /Users/..../node_modules/#docusaurus/responsive-loader/sharp.js
- /Users/.../node_modules/#docusaurus/plugin-ideal-image/lib/index.js
- /Users/.../node_modules/#docusaurus/core/lib/server/plugins/init.js
- /Users/.../node_modules/#docusaurus/core/lib/server/plugins/index.js
- /Users/.../node_modules/#docusaurus/core/lib/server/index.js
- /Users/.../node_modules/#docusaurus/core/lib/commands/build.js
- /Users/.../node_modules/#docusaurus/core/lib/index.js
- /Users/.../node_modules/#docusaurus/core/bin/docusaurus.js
Possible solutions:
- Install with the --verbose flag and look for errors: "npm install --ignore-scripts=false --verbose sharp"
- Install for the current runtime: "npm install --platform=darwin --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:93:18)
at Module._compile (internal/modules/cjs/loader.js:1085:14)

Related

Expo Eas build error ios internal dev - Cannot find module yargs

I encountered a eas build pb with ios. I have an Cannot find module yargs on the run fastlane process.
Here is my config:
expo-env-info 1.0.5 environment info:
System:
OS: macOS 12.5
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.13.1 - ~/.nvm/versions/node/v16.13.1/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.1.2 - ~/.nvm/versions/node/v16.13.1/bin/npm
Watchman: 2022.10.24.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.1, iOS 16.1, macOS 13.0, tvOS 16.1, watchOS 9.1
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9123335
Xcode: 14.1/14B47b - /usr/bin/xcodebuild
npmPackages:
#expo/metro-config: ^0.5.1 => 0.5.1
#expo/webpack-config: ^0.17.2 => 0.17.3
expo: ~47.0.8 => 47.0.8
react: 18.1.0 => 18.1.0
react-dom: 18.1.0 => 18.1.0
react-native: 0.70.5 => 0.70.5
react-native-web: ~0.18.7 => 0.18.10
npmGlobalPackages:
eas-cli: 2.7.1
expo-cli: 6.0.8
Expo Workflow: bare
Do you have any idea? Do you need more infos? I had succesfull builds before installing and using rnfirebase. Everything works as expected on my local environment.
Error: Cannot find module 'yargs'
Require stack:
- /Users/expo/workingdir/build/node_modules/react-native/scripts/generate-specs-cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:985:15)
at Function.Module._load (node:internal/modules/cjs/loader:833:27)
at Module.require (node:internal/modules/cjs/loader:1057:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object.<anonymous> (/Users/expo/workingdir/build/node_modules/react-native/scripts/generate-specs-cli.js:12:15)
at Module._compile (node:internal/modules/cjs/loader:1155:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1209:10)
at Module.load (node:internal/modules/cjs/loader:1033:32)
at Function.Module._load (node:internal/modules/cjs/loader:868:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/expo/workingdir/build/node_modules/react-native/scripts/generate-specs- cli.js'
]
}

node Sass Support to current version environment (Ionic)

in the ionic app
trying to run ionic emulate ios but following error is coming
ionic-hello-world# ionic:build /Users/farrukhqamar/HybridApps/helloWorld
ionic-app-scripts build
keywords if/then/else require v5 option
/Users/farrukhqamar/HybridApps/helloWorld/node_modules/node-sass/lib/index.js:13
throw new Error(errors.unsupportedEnvironment());
^
Error: Node Sass does not yet support your current environment: OS X 64-bit with Unsupported runtime (51)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v3.10.1
at Object. (/Users/farrukhqamar/HybridApps/helloWorld/node_modules/node-sass/lib/index.js:13:11)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/Users/farrukhqamar/HybridApps/helloWorld/node_modules/#ionic/app-scripts/dist/sass.js:11:19)
at Module._compile (module.js:571:32)
In the morning every thing was working but just start happening now in my current project
If i create a new project then it runs perfectly.
I am very new in ionic so please suggest some solution
Runtime (Node Module ABI) version 51 means it's an Electron environment, which node-sass doesn't directly support.

ember-cli gives "Unexpected end of JSON input"

I have recent node (7.1.0) and npm (4.0.2) installations on macOS Sierra 10.12.1 with Xcode 8.1. The installation of the ember-cli package seems to work fine apart from two warnings:
08:51 $ npm install -g ember-cli
npm WARN deprecated node-uuid#1.4.7: use uuid module instead
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/usr/local/bin/ember -> /usr/local/lib/node_modules/ember-cli/bin/ember
/usr/local/lib
└── ember-cli#2.9.1
But when I call ember it always gives me the following error:
08:52 $ ember --help
module.js:593
throw err;
^
SyntaxError: /Users/torstenkemps-benedix/package.json: Unexpected end of JSON input
at JSON.parse (<anonymous>)
at Object.Module._extensions..json (module.js:590:27)
at Module.load (module.js:490:32)
at tryModuleLoad (module.js:449:12)
at Function.Module._load (module.js:441:3)
at Module.require (module.js:500:17)
at require (internal/module.js:20:19)
at Function.Project.getProjectRoot (/usr/local/lib/node_modules/ember-cli/lib/models/project.js:662:13)
at module.exports (/usr/local/lib/node_modules/ember-cli/lib/cli/index.js:76:22)
at /usr/local/lib/node_modules/ember-cli/bin/ember:27:3
How can I get ember to run correctly?

Unable to use ember-cli without manually deleting "tmp" directory after every command

I am new to Ember and just installed the ember-cli:
npm install -g ember-cli
and it seems to install fine:
D:\>ember -v
ember-cli: 2.7.0
node: 4.4.5
os: win32 x64
When I repeat the identical version command (ember -v), I get the following error message:
D:\>ember -v
fs.js:794
return binding.mkdir(pathModule._makeLong(path),
^
Error: EEXIST: file already exists, mkdir 'D:\tmp'
at Error (native)
at Object.fs.mkdirSync (fs.js:794:18)
at testCanSymlink (C:\Users\joeal_000\AppData\Roaming\npm\node_modules\ember-cli\node_modules\symlink-or-copy\index.js:18:6)
at Object.<anonymous> (C:\Users\joeal_000\AppData\Roaming\npm\node_modules\ember-cli\node_modules\symlink-or-copy\index.js:9:15)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
The first "ember -v" command creates a directory named "tmp" in directory that I am in when I issue the "ember" command. If I delete this "tmp" directory, everything works fine again:
D:\>rmdir /s tmp
tmp, Are you sure (Y/N)? y
D:\>ember -v
ember-cli: 2.7.0
node: 4.4.5
os: win32 x64
Here are my versions of node and npm:
D:\>node -v
v4.4.5
D:\>npm -v
2.15.5
How can I stop this behavior from occurring, whever I have to delete the "tmp" file after every ember command?
Thanks for the help.
ember-cli temporarily broken because of a dependent package.
The issue was resolved a few minutes ago: https://github.com/broccolijs/node-symlink-or-copy/issues/26#event-746775676
Just do npm install again after deleting your nodes_module directory.
try deleting all node modules directory, and do npm install, or better place your ember not in C drive

Cannot load node.js native addon when built with node-gyp, but it works when built with Visual Studio

I've written a native addon for node.js, compiled it with MSVC++ without node-gyp, and used it successfully on the node REPL and in an application. I'm using x64 node and compiling an x64 addon. I'm trying to get the thing to build with node-gyp. I've gotten node-gyp to generate a Visual Studio solution and compile it, but the addon that comes out does not work. The only error I get is this:
Error: The specified procedure could not be found.
at Object.Module._extensions..node (module.js:480:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at repl:1:13
at REPLServer.self.eval (repl.js:111:21)
at rli.on.e (repl.js:260:20)
at REPLServer.self.eval (repl.js:118:5)
at Interface.<anonymous> (repl.js:250:12)
When I run a script that tries to load the addon, I get this:
module.js:480
process.dlopen(filename, module.exports);
^
Error: The specified procedure could not be found.
at Object.Module._extensions..node (module.js:480:11)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Object.<anonymous> (c:\blah\testheaders.js:1:75)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
I've learned that dlopen has something to do with loading dynamic libraries on Linux, but can't find any useful information relevant to node (in particular, on Windows.). This addon requires some third-party dlls, but they are on my path, and again, the addon works fine when I compile it without node-gyp.
What do I need to do to figure out how to make this work?
It turned out that the problem lay in my use of the NODE_MODULE macro. I had something like this:
NODE_MODULE(SomeAddonName, Init)
But my binding.gyp had this:
"target_name": "totallyDifferentName",
It turns out that target_name in binding.gyp must be the same as the module name (the first argument to NODE_MODULE).
Thanks to #TooTallNate for helping me with this!