Cannot find module 'php'
Error: Cannot find module 'php'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at new View (F:\Users\MichaelJacksonIsDead\publisherServer\node_modules\express\lib\view.js:50:49)
at EventEmitter.app.render (F:\Users\MichaelJacksonIsDead\publisherServer\node_modules\express\lib\application.js:545:12)
at ServerResponse.res.render (F:\Users\MichaelJacksonIsDead\publisherServer\node_modules\express\lib\response.js:938:7)
at F:\Users\MichaelJacksonIsDead\publisherServer\routes\index.js:12:6
at Layer.handle [as handle_request] (F:\Users\MichaelJacksonIsDead\publisherServer\node_modules\express\lib\router\layer.js:82:5)
at next (F:\Users\MichaelJacksonIsDead\publisherServer\node_modules\express\lib\router\route.js:110:13)
的路径选择这个页面呈现为PHP如下:
router.get('/index.php', function(req, res, next) {
var render = require('php-node')({bin:"F:\\xampp\php\\php.exe"});
res.render('index.php');
});
我遇到一个NPM安装-g ,npm安装节点php -g在项目级别和以上级别都没有成功:
F:\Users\MichaelJacksonIsDead\publisherServer>npm install -g
[email protected] F:\Users\MichaelJacksonIsDead\AppData\Roaming\npm\node_mod
ules\publisherServer
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected]
0.2, [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], f
[email protected], [email protected], [email protected], [email protected], range-parse
[email protected], [email protected], [email protected], [email protected], [email protected], ser
[email protected], [email protected], [email protected], [email protected], on
[email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
6.2, [email protected])
├── [email protected] ([email protected])
└── [email protected] ([email protected], [email protected], [email protected])
F:\Users\MichaelJacksonIsDead\publisherServer>npm start
> publisherS[email protected] start F:\Users\MichaelJacksonIsDead\publisherServer
> node ./bin/www
GET /index.php 500 41.145 ms - 954
有没有人有这个问题expirence?至于我可以告诉大家我已经正确安装......也想确保我加入了包到我的JSON文件,如下所示:
"dependencies": {
"body-parser": "~1.12.4",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.12.4",
"hjs": "~0.0.6",
"less-middleware": "1.0.x",
"morgan": "~1.5.3",
"serve-favicon": "~2.2.1",
"php-node": "0.0.2"
}
最后我没有足够的代表开个标签PHP节点该项目@https://www.npmjs.com/package/php-node,而不是一个问题,但会的是很高兴有一个更speficic标签:)
它看起来并不像你遵循[说明](https://github.com/digplan/php-node),而是你需要路由中的中间件? – adeneo