我在流星应用程序部署meteor时遇到问题.我在这里遵循了这个教程.我也尝试使用ZEIT的 OSX Client进行部署,但它总是会抛出同样的错误.
有没有人知道解决方法?

编辑1:这是我的package.json
{
"name": "helloworld",
"private": true,
"scripts": {
"start": "meteor run"
},
"dependencies": {
"babel-runtime": "^6.26.0",
"meteor-node-stubs": "^0.3.2"
}
}
Run Code Online (Sandbox Code Playgroud) 我在 node-red 项目中使用zeit/pkg时遇到了一些问题。以下是重现问题的步骤:
git clone https://github.com/node-red/node-red.gitcd node-rednpm installnpm run build
在构建命令后,我将以下内容添加到我的 package.json 文件中:
"pkg": {
"assets": [
"./red/**/*"
],
"scripts": [
"./red/**/*.js"
]
}
Run Code Online (Sandbox Code Playgroud)运行命令 pkg .
运行后,pkg .我收到以下错误:
C:\xampp\htdocs\node-red>pkg .
> pkg@4.3.4
> Targets not specified. Assuming:
node8-linux-x64, node8-macos-x64, node8-win-x64
> Warning Cannot resolve 'path.join(__dirname, '..', '..', 'package.json')'
C:\xampp\htdocs\node-red\red\runtime\index.js
Dynamic require may fail at run time, because the requested file
is unknown at compilation time and not included into executable.
Use a …Run Code Online (Sandbox Code Playgroud) Pkg CLI将 node.js 应用程序打包成可执行文件。
在运行时,应用程序应访问全局/snapshots/文件夹(或C:\snapshots\在 Windows 上)中的资源。
Pkg由于共享一个快照目录而只能同时运行一个应用程序?我找不到这方面的任何信息,而且似乎不对......
我使用 pkg 打包了我的 cli 应用程序,它在 macOS 上运行良好,但无法在 Windows 上运行,并抱怨 keytar.node 二进制文件。我使用在开发机器(macOS)上安装的相同的 keytar.node 来在 Windows 上运行。我想知道它是否会因为在不同操作系统上编译本机节点二进制文件而引发错误?如果是这种情况,有什么方法可以使用 keytar.node 跨平台而无需在单个操作系统上编译它?
错误://?/C:/Users/alias/bin/keytar.node 不是有效的 Win32 应用程序。
//?/C:/Users/alias/bin/keytar.node
at Module.require (pkg/prelude/bootstrap.js:1229:31)
at Object.<anonymous> (C:/snapshot/pcas-cli/node_modules/keytar/lib/keytar.js:1:76)
at Module._compile (pkg/prelude/bootstrap.js:1324:22)
Run Code Online (Sandbox Code Playgroud)
任何形式的帮助将不胜感激。谢谢
我正在使用 Docker 创建一个 Next.js 项目,但每次运行时docker build,Docker映像都是 300 MB+。我的目标是减小 docker 镜像的大小。为此,我开始使用zeit/pkg,但它无法正常工作。
题:
Next.js 中需要哪些文件docker build?(我在每个教程中都看到COPY . .)
以及如何减小 docker 图像的大小?
我跟着这个教程:https : //medium.com/@evenchange4/deploy-a-commercial-next-js-application-with-pkg-and-docker-5c73d4af2ee
Dockerfile:
FROM node:lts-alpine as build-env
WORKDIR /app
COPY . .
RUN yarn install --pure-lockfile --ignore-engines
ENV NODE_ENV=production
RUN yarn run build
RUN yarn run pkg
FROM node:alpine
RUN apk update && \
apk add --no-cache libstdc++ libgcc ca-certificates && \
rm -rf /var/cache/apk/*
WORKDIR /app
COPY --from=build-env /app/pkg . …Run Code Online (Sandbox Code Playgroud) 我想在已编译的node.js应用程序中使用一个简单的数据库。无需单独安装数据库是否可以实现?即我希望数据库包含在.exe文件中,以便我可以复制并执行该文件。
我正在使用pkg创建.exe文件,并且效果很好,但是当我使用sqlite3 npm模块尝试执行以下警告时,.exe错误出现了:
pkg/prelude/bootstrap.js:1155
throw error;
^
Error: Cannot find module 'C:\snapshot\sqlite\node_modules\sqlite3\lib\binding\node-v51-win32-x64\node_sqlite3.node'
1) If you want to compile the package/file into executable, please pay attention to compilation warnings and specify a literal in 'require' call. 2) If you don't want to compile the package/file into executable and want to 'require' it from filesystem (likely plugin), specify an absolute path in 'require' call using process.cwd() or process.execPath.
at Function.Module._resolveFilename (module.js:470:15)
at Function.Module._resolveFilename (pkg/prelude/bootstrap.js:1252:46)
at Function.Module._load (module.js:418:25)
at Module.require …Run Code Online (Sandbox Code Playgroud) zeit-pkg ×6
node.js ×4
javascript ×2
docker-image ×1
dockerfile ×1
keytar ×1
meteor ×1
next.js ×1
node-red ×1
npm ×1
packaging ×1
sqlite ×1