繁体   English   中英

Node.js应用程序未在生产环境中执行

[英]Node.js application not executing in production env

我是node.js的新手,因此无法正确理解错误。 根据帆文件https://sailsjs.com/documentation/concepts/deployment

我正在尝试使用NODE_ENV=production node app.js执行sails.js应用程序,但是它NODE_ENV=production node app.js一些错误。 虽然可以使用npm run dev在开发环境中正常工作

目前在我的项目中禁用了会话。 现在,其他警告已被删除。

$ NODE_ENV=production node app
error: ** Grunt :: An error occurred. **
error:
------------------------------------------------------------------------
Aborted due to warnings.
Running "babel:dist" (babel) task
Warning: .tmp/public/js/sdk.js: 'with' in strict mode (22:780)
------------------------------------------------------------------------
error: Looks like a Grunt error occurred--
error: Please fix it, then **restart Sails** to resume watching for changes to assets:
error:      CTRL+C, then `sails lift`
error: Or if you're stuck, check out the troubleshooting tips below.
error: Troubleshooting tips:
error:
error:  *-> Are "grunt" and any custom Grunt plugins you're using installed in this project?
error:      Run `npm install` if you're not sure.
error:
error:  *-> You might have a typo in one of your LESS files, etc.
error:
error:  *-> Or maybe you don't have permissions to access the `.tmp` directory?
error:      e.g., `C:\xampp\htdocs\soochna_sails\.tmp` ?
error:
error:      If you think this might be the case, try running:
error:      sudo chown -R YOUR_COMPUTER_USER_NAME C:\xampp\htdocs\soochna_sails\.tmp
error:
error:  *-> If you're still unsure, drop by https://sailsjs.com/support.

我的package.json文件是

"description": "a Sails application",
    "keywords": [],
    "dependencies": {
        "@sailshq/connect-redis": "^3.2.1",
        "@sailshq/lodash": "^3.10.3",
        "@sailshq/socket.io-redis": "^5.2.0",
        "async": "2.0.1",
        "grunt": "1.0.1",
        "nodemon": "^1.17.5",
        "sails": "^1.0.2",
        "sails-hook-autoreload-extend": "^1.0.4",
        "sails-hook-grunt": "^3.0.2",
        "sails-hook-orm": "^2.0.0-16",
        "sails-hook-sockets": "^1.4.0",
        "sails-mysql": "1.0.0",
        "dropzone": "5.5.1"
    },
    "devDependencies": {
        "@sailshq/eslint": "^4.19.3"
    },
    "scripts": {
        "start": "NODE_ENV=production --ignore 'tmp/*' node app.js",
        "dev": "set NODE_ENV=development && nodemon --ignore 'tmp/*' app.js && exit 0",
        "test": "npm run lint && npm run custom-tests && echo 'Done.'",
        "lint": "eslint . --max-warnings=0 --report-unused-disable-directives && echo '✔  Your .js files look good.'",
        "custom-tests": "echo \"(No other custom tests yet.)\" && echo"
    },
    "main": "app.js",
    "repository": {
        "type": "git",
        "url": "git://github.com/xxxxxxx/test-project.git"
    },

    "license": "",
    "engines": {
        "node": ">=9.11"
    }

任何帮助将不胜感激。

我也遇到了很多这个问题。 这是有趣的部分:

错误:*->还是您没有访问.tmp目录的权限? 错误:例如C:\\xampp\\htdocs\\soochna_sails\\.tmp吗? 错误:错误:如果您认为可能是这种情况,请尝试运行:错误:sudo chown -R YOUR_COMPUTER_USER_NAME C:\\ xampp \\ htdocs \\ soochna_sails.tmp

您显然是托管在Windows上的,因此在生产模式下启动应用程序之前,请尝试使.tmp文件夹具有写访问性,或者手动将其删除。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM