Announcement

Collapse
No announcement yet.

Permission denied setting ENV variables in Node JS

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Permission denied setting ENV variables in Node JS

    I'm building a todo app using Node, Express, Mongo - with no front end.

    I'm failing to get an NPM module called "env-cmd" that sets environment variables to run.

    I've been fiddling with it but I'm at a total loss as to how to proceed and would appreciate any help.

    When I attempt to run the app with that module I get the following output

    Code:
    hoo@BadWolf:~/storage/node-task-api v3$ npm run dev
    
    > node-task-manager@1.0.0 dev /home/hoo/storage/node-task-api v3
    > env-cmd ./config/dev.env nodemon src/index.js
    
    sh: 1: env-cmd: Permission denied
    
    npm ERR! Linux 4.15.0-50-generic
    npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
    npm ERR! node v8.10.0
    npm ERR! npm  v3.5.2
    npm ERR! code ELIFECYCLE
    npm ERR! node-task-manager@1.0.0 dev: `env-cmd ./config/dev.env nodemon src/index.js`
    npm ERR! Exit status 126
    npm ERR! 
    npm ERR! Failed at the node-task-manager@1.0.0 dev script 'env-cmd ./config/dev.env nodemon src/index.js'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR!
    
    If you do, this is most likely a problem with the node-task-manager package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR! env-cmd ./config/dev.env nodemon src/index.js
    npm ERR! You can get information on how to open an issue for this project with:
    npm ERR! npm bugs node-task-manager
    npm ERR! Or if that isn't available, you can get their info via:
    npm ERR! npm owner ls node-task-manager
    npm ERR! There is likely additional logging output above.
    
    npm ERR! Please include the following file with any support request:
    npm ERR! /home/hoo/storage/node-task-api v3/npm-debug.log
    The debug.log output

    Code:
    0 info it worked if it ends with ok
    1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'dev' ]
    2 info using npm@3.5.2
    3 info using node@v8.10.0
    4 verbose run-script [ 'predev', 'dev', 'postdev' ]
    5 info lifecycle node-task-manager@1.0.0~predev: node-task-manager@1.0.0
    6 silly lifecycle node-task-manager@1.0.0~predev: no script for predev, continuing
    7 info lifecycle node-task-manager@1.0.0~dev: node-task-manager@1.0.0
    8 verbose lifecycle node-task-manager@1.0.0~dev: unsafe-perm in lifecycle true
    9 verbose lifecycle node-task-manager@1.0.0~dev: PATH: /usr/share/npm/bin/node-gyp-bin:/home/hoo/storage/node-task-api v3/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
    10 verbose lifecycle node-task-manager@1.0.0~dev: CWD: /home/hoo/storage/node-task-api v3
    11 silly lifecycle node-task-manager@1.0.0~dev: Args: [ '-c', 'env-cmd ./config/dev.env nodemon src/index.js' ]
    12 silly lifecycle node-task-manager@1.0.0~dev: Returned: code: 126  signal: null
    13 info lifecycle node-task-manager@1.0.0~dev: Failed to exec dev script
    14 verbose stack Error: node-task-manager@1.0.0 dev: `env-cmd ./config/dev.env nodemon src/index.js`
    14 verbose stack Exit status 126
    14 verbose stack     at EventEmitter.<anonymous> (/usr/share/npm/lib/utils/lifecycle.js:232:16)
    14 verbose stack     at emitTwo (events.js:126:13)
    14 verbose stack     at EventEmitter.emit (events.js:214:7)
    14 verbose stack     at ChildProcess.<anonymous> (/usr/share/npm/lib/utils/spawn.js:24:14)
    14 verbose stack     at emitTwo (events.js:126:13)
    14 verbose stack     at ChildProcess.emit (events.js:214:7)
    14 verbose stack     at maybeClose (internal/child_process.js:925:16)
    14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
    15 verbose pkgid node-task-manager@1.0.0
    16 verbose cwd /home/hoo/storage/node-task-api v3
    17 error Linux 4.15.0-50-generic
    18 error argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
    19 error node v8.10.0
    20 error npm  v3.5.2
    21 error code ELIFECYCLE
    22 error node-task-manager@1.0.0 dev: `env-cmd ./config/dev.env nodemon src/index.js`
    22 error Exit status 126
    23 error Failed at the node-task-manager@1.0.0 dev script 'env-cmd ./config/dev.env nodemon src/index.js'.
    23 error Make sure you have the latest version of node.js and npm installed.
    23 error If you do, this is most likely a problem with the node-task-manager package,
    23 error not with npm itself.
    23 error Tell the author that this fails on your system:
    23 error     env-cmd ./config/dev.env nodemon src/index.js
    23 error You can get information on how to open an issue for this project with:
    23 error     npm bugs node-task-manager
    23 error Or if that isn't available, you can get their info via:
    23 error     npm owner ls node-task-manager
    23 error There is likely additional logging output above.
    24 verbose exit [ 1, true ]

    #2
    The node-task-manager package seems dead. Hasn't been updated in three years. https://github.com/mattpage/node-task-manager

    I would find an alternative to that package.

    Comment

    Working...
    X