Skip to content
This repository was archived by the owner on Apr 6, 2021. It is now read-only.
This repository was archived by the owner on Apr 6, 2021. It is now read-only.

Error: Cannot find module 'optimist' #517

Open

Description

@AprilNEA

ubuntu@:~/c9sdk$ node server.js
/home/ubuntu/c9sdk/node_modules/c9/setup_paths.js:34
throw e;
^

Error: Cannot find module 'optimist'
at Module._resolveFilename (module.js:547:15)
at Function.modules._resolveFilename (/home/ubuntu/c9sdk/node_modules/c9/setup_paths.js:27:16)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at main (/home/ubuntu/c9sdk/server.js:74:20)
at Object. (/home/ubuntu/c9sdk/server.js:55:5)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)

Activity

  1. georgir commented on Aug 15, 2018

    @georgir

    have you ran scripts/install-sdk.sh?

  2. 42yeah commented on Sep 1, 2018

    @42yeah

    maybe you should try npm install?

  3. RodolVelasco commented on Sep 14, 2018

    @RodolVelasco

    @POTION4 I have tried to install npm install but I'm getting:

    luis.velasco2@is-di-dev-endpoints:/var/www/html/c9sdk$ sudo npm install
    npm WARN deprecated connect@2.12.0: connect 2.x series is deprecated
    npm WARN deprecated ejs@1.0.0: Critical security bugs fixed in 2.5.5
    npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
    npm WARN deprecated hoek@2.16.3: The major version is no longer supported. Please update to 4.x or newer
    npm ERR! code 128
    npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b master https://github.com/cloud9ide/tern_from_ts.git /root/.npm/_cacache/tmp/git-clone-d384bd0d
    npm ERR! fatal: could not create leading directories of '/root/.npm/_cacache/tmp/git-clone-d384bd0d': Permission denied
    npm ERR!
    
    npm ERR! A complete log of this run can be found in:
    npm ERR!     /root/.npm/_logs/2018-09-14T15_55_17_757Z-debug.log
    

    What could be happening?

  4. wgailey commented on Nov 25, 2018

    @wgailey

    "npm install" is the problem because it wipes out node_modules leaving only the few it installs by default and nearly none of those required by c9. Doing "npm i optimist" and the rest, will eventually leave you with a few that c9 needs but don't exist elsewhere. I heard someone mention they cp'd the node_modules folder and replaced it after running the npm install but other than that... there has to be a cleaner way to do this... also the install-sdk script runs an npm install of sorts but editing this file is pointless because it does this weird thing where it gets replaced with a tmp.

    I was able to get the install script to run correctly and successfully by changing that crap bit of line "$NPM -production" to "npm install npm -g" (as basically a run once because the tmp replace) but of course it still wipes out the node_modules so maybe throw some "npm i"s in afterwards...

  5. georgir commented on Nov 26, 2018

    @georgir

    install-sdk.sh already does npm install so no need to run that separately
    just tried with a fresh git clone, ./scripts/install-sdk.sh was all that was needed, worked just fine.
    npm 6, node 8

  6. ronaldroe commented on Apr 28, 2019

    @ronaldroe

    I had this problem, and I fixed it by doing 2 things:

    1. It was on a new Linux install, and I hadn't yet installed node/npm, so when the script ran npm install, it didn't. Perhaps the install script should error out in that case?

    2. I kept getting a tmux error related to encoding. I added en_us UTF-8 as a locale, which fixed that problem.

    After that, I ran the install script again, and it worked without an issue. Sounds like when this problem arises, something is halting the npm install, or exiting before it runs.

  7. lalizita commented on Apr 15, 2020

    @lalizita

    is it solved?

  8. wgailey commented on Apr 16, 2020

    @wgailey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions