Nodejs 代码无法在 Windows10 上构建,但可以在 MacOS 上运行。可能是什么原因?
Nodejs code fails to build on Windows10 but works on MacOS. What might be the cause?
我正在尝试在 Windows10
上构建和部署来自 https://github.com/Autodesk-Forge/forge-rcdb.nodejs 的代码
在 MacOS 上,我在开发环境中成功构建了它,现在我正在尝试在 Windows 上实现它。我按照相同的步骤,在 Windows 上,我使用了:
$env:NODE_ENV = "developement"
$env:HOT_RELOADING="true"
npm start
但是我的 Powershell 显示:
> forge-rcdb@4.0.0 start D:\Documents\forge-rcdb.nodejs
> node bin/start.js
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module '../../config/developement.config.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (D:\Documents\forge-rcdb.nodejs\node_modules\c0nfig\index.js:10:14)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.require.extensions.(anonymous function) [as .js] (D:\Documents\forge-rcdb.nodejs\node_modules\babel-register\lib\node.js:152:7)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! forge-rcdb@4.0.0 start: `node bin/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the forge-rcdb@4.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\yangdihan\AppData\Roaming\npm-cache\_logs18-12-28T21_12_28_942Z-debug.log
PS D:\Documents\forge-rcdb.nodejs> npm install cairo
npm ERR! code E404
npm ERR! 404 Not Found: cairo@latest
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\yangdihan\AppData\Roaming\npm-cache\_logs18-12-28T21_20_30_522Z-debug.log
这可能是因为 Windows 路径有反斜杠而不是斜杠?
development
似乎有一个拼写错误(developement
),这导致了错误:
Error: Cannot find module '../../config/developement.config.js'
将您的环境设置为 config
文件夹中相应的配置文件,否则 c0nfig
库将无法找到配置:
config -
|--- development.config.js
|--- production.config.js
我终于解决了。
解决方法是安装Python2.7,C++编译器,c#编译器。只需使用 Visual Studio 安装程序安装它们就可以了。
然后很可能需要按照以下说明修复 npm canvas/cairo:https://github.com/benjamind/delarre.docpad/blob/master/src/documents/posts/installing-node-canvas-for-windows.html.md
然后一切正常
我正在尝试在 Windows10
上构建和部署来自 https://github.com/Autodesk-Forge/forge-rcdb.nodejs 的代码在 MacOS 上,我在开发环境中成功构建了它,现在我正在尝试在 Windows 上实现它。我按照相同的步骤,在 Windows 上,我使用了:
$env:NODE_ENV = "developement"
$env:HOT_RELOADING="true"
npm start
但是我的 Powershell 显示:
> forge-rcdb@4.0.0 start D:\Documents\forge-rcdb.nodejs
> node bin/start.js
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module '../../config/developement.config.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (D:\Documents\forge-rcdb.nodejs\node_modules\c0nfig\index.js:10:14)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Object.require.extensions.(anonymous function) [as .js] (D:\Documents\forge-rcdb.nodejs\node_modules\babel-register\lib\node.js:152:7)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! forge-rcdb@4.0.0 start: `node bin/start.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the forge-rcdb@4.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\yangdihan\AppData\Roaming\npm-cache\_logs18-12-28T21_12_28_942Z-debug.log
PS D:\Documents\forge-rcdb.nodejs> npm install cairo
npm ERR! code E404
npm ERR! 404 Not Found: cairo@latest
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\yangdihan\AppData\Roaming\npm-cache\_logs18-12-28T21_20_30_522Z-debug.log
这可能是因为 Windows 路径有反斜杠而不是斜杠?
development
似乎有一个拼写错误(developement
),这导致了错误:
Error: Cannot find module '../../config/developement.config.js'
将您的环境设置为 config
文件夹中相应的配置文件,否则 c0nfig
库将无法找到配置:
config -
|--- development.config.js
|--- production.config.js
我终于解决了。 解决方法是安装Python2.7,C++编译器,c#编译器。只需使用 Visual Studio 安装程序安装它们就可以了。 然后很可能需要按照以下说明修复 npm canvas/cairo:https://github.com/benjamind/delarre.docpad/blob/master/src/documents/posts/installing-node-canvas-for-windows.html.md
然后一切正常