sh: npm command not found

This topic contains 14 replies, has 5 voices, and was last updated by  Brian Fernandes 2 months, 2 weeks ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #508193 Reply

    Bernard
    Participant

    hello

    I’m new to javascript and angular
    my computer is a win10 64bit

    I have installed Webclise Suite 1.6.0.20104
    I am trying to import my git project as an angular2 project, using the wizard but I get the error
    sh: npm command not found

    I therefore included following in my path C:\Users\Bernard C\.webclipse\nodejs\7.2.1
    and retried now I’m getting following error

    /c/Users/Bernard C/.webclipse/nodejs/7.2.1/npm: line 4: dirname: command not found
    /c/Users/Bernard C/.webclipse/nodejs/7.2.1/npm: line 6: uname: command not found
    /c/Users/Bernard C/.webclipse/nodejs/7.2.1/npm: line 17: uname: command not found
    module.js:472
    throw err;
    ^

    Error: Cannot find module ‘C:\ExternalPrograms\Git\node_modules\npm\bin\npm-cli.js’
    at Function.Module._resolveFilename (module.js:470:15)
    at Function.Module._load (module.js:418:25)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:420:7)
    at startup (bootstrap_node.js:139:9)
    at bootstrap_node.js:535:3

    Can you please advise as looks as though i thinks I’m running on a linux, or Mac machine and not windows.?

    #508262 Reply

    support-piotr
    Participant

    Hi Bernard!

    Thanks for checking out Webclipse! You should definitely not be getting those errors when importing project a using Angular 2 import wizard. To help you resolve the issue, I need more information. Could you please specify which wizard you have used exactly and share some screenshots of the import process and the error itself, so that I am able to tell what exactly is going on and resolve the issue. Package.json file from your proejct would be handy as well (change extension to txt if to upload the file on forum)

    Best regards,
    Piotr Tomiak

    #508744 Reply

    Bernard
    Participant

    Hi Piotr,

    Sorry for late reply, the problem was my end although not really sure exactly what it was, but after removing absolutely everything webclipse installed including complete contents of c:\User\AppData\Roaming a reinstall worked ok.

    regards
    Bernard

    #508976 Reply

    support-piotr
    Participant

    Hi Bernard,

    Happy to hear that! However, our code is supposed to work in any environment, so I hoped to find out the cause of your issue to be able to avoid them in the future. Anyway, thanks for letting us know!

    Best regards,
    Piotr Tomiak

    #543996 Reply

    rdh_rmn
    Participant

    I am presently getting exactly similar error. I took clone of git code and then did “Import projects”.
    Then while starting the server Angular CLI gave me below error.
    I do not like to uninstall at this moment. Please help.

    Pop up:
    Unexpected exit value executing:
    npm install –save-dev angular-ide (exit value: 127)
    Terminal window:
    npm install –save-dev angular-ide
    bash: npm: command not found

    #544004 Reply

    rdh_rmn
    Participant

    After setting node.js and NPM version in CLI tool management

    Pop up:::
    Angular CLI is not installed properly – file ng-soap/node_modules/.bin/ng not found.
    Angular CLI is not installed properly – file ng-soap/node_modules/.bin/ng not found.

    Terminal::::
    Node.js version: v8.9.1
    NPM version: 5.5.1
    npm install –save-dev angular-ide

    > angular-ide@0.9.38 postinstall C:\Users\apps\git\ng-soap\node_modules\angular-ide
    > node ./scripts/post.js

    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules\fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {“os”:”darwin”,”arch”:”any”} (current: {“os”:”win32″,”arch”:”x64″})

    + angular-ide@0.9.38
    added 116 packages and updated 1 package in 33.472s

    #544006 Reply

    Brian Fernandes
    Moderator

    rdh,

    Just to level set – is this an Angular CLI based project?

    I’m assuming you used the Angular import wizard (File > Import > Angular > Angular Project) to import your project? If so, the node_modules should have been properly installed as part of the import process and the Node / NPM versions should also have been set up. If you used another import process, now that you have the Terminal+ correctly set up, maybe you just need to run npm install in the project folder? I’m not sure if the node dependencies have already been downloaded for your project – check the ng-soap/node_modules folder.

    #544012 Reply

    rdh_rmn
    Participant

    You may try using below git code cloning and then importing.
    https://github.com/chihu-team/chihu-web-angular.git

    #544016 Reply

    Brian Fernandes
    Moderator

    Thanks – from your link I can see that this is indeed an Angular CLI project, good.

    However, could you let me know how you imported (what wizard you used) and if you did try to run npm install in the project after I suggested it above? If not, can you please try running that and see if the cli module is now found?

    In the meanwhile, I’ll have my team try this project as well.

    Thanks!

    #544077 Reply

    support-swapna
    Moderator

    rdh,

    I cloned this repo : https://github.com/chihu-team/chihu-web-angular.git and then selected the ‘Import Projects’ from the Git Repositories view. Once imported, I ran the ‘npm install’ command from the Terminal+ for the project and I see no problems running it from the Servers view. Please see the attached screenshot.

    Please run the ‘npm install’ as suggested by Brian and let us know how it works for you.

    Apologies for inconvenience caused.

    –Swapna
    MyEclipse Support

    Attachments:
    You must be logged in to view attached files.
    #544087 Reply

    rdh_rmn
    Participant

    Hi Brian,
    I followed (File > Import > Angular > Angular Project. Used “https://github.com/chihu-team/chihu-web-angular.git” Still got the issue as below. Please suggest.
    If my IDE corrupted, which thing I need to check. Note, any project created in IDE works fine. I am trying in my laptop. I am using webclise Angular IDE 2017 CI (version 17).
    I have attached the file that I have tried.

    Swapna, it does not work for me and that is the issue I am facing.

    Node.js version: v8.9.1
    NPM version: 5.5.1
    npm install

    > node-sass@4.7.2 install C:\Users\apps\Workspaces\Angular IDE 2017 CI\chihuwebangularNew\node_modules\node-sass
    > node scripts/install.js

    Cached binary found at C:\Users\apps\AppData\Roaming\npm-cache\node-sass\4.7.2\win32-x64-57_binding.node

    > node-sass@4.7.2 postinstall C:\Users\apps\Workspaces\Angular IDE 2017 CI\chihuwebangularNew\node_modules\node-sass
    > node scripts/build.js

    Binary found at C:\Users\apps\Workspaces\Angular IDE 2017 CI\chihuwebangularNew\node_modules\node-sass\vendor\win32-x64-57\binding.node
    Testing binary
    Binary is fine
    npm ERR! path C:\Users\apps\Workspaces\Angular IDE 2017 CI\chihuwebangularNew\node_modules\fsevents\node_modules
    npm ERR! code EPERM
    npm ERR! errno -4048
    npm ERR! syscall lstat
    npm ERR! Error: EPERM: operation not permitted, lstat ‘C:\Users\apps\Workspaces\Angular IDE 2017 CI\chihuwebangularNew\node_modules\fsevents\node_modules’
    npm ERR! { Error: EPERM: operation not permitted, lstat ‘C:\Users\apps\Workspaces\Angular IDE 2017 CI\chihuwebangularNew\node_modules\fsevents\node_modules’
    npm ERR! stack: ‘Error: EPERM: operation not permitted, lstat \’C:\\Users\\apps\\Workspaces\\Angular IDE 2017 CI\\chihuwebangularNew\\node_modules\\fsevents\\node_mod
    ules\”,
    npm ERR! errno: -4048,
    npm ERR! code: ‘EPERM’,
    npm ERR! syscall: ‘lstat’,
    npm ERR! path: ‘C:\\Users\\apps\\Workspaces\\Angular IDE 2017 CI\\chihuwebangularNew\\node_modules\\fsevents\\node_modules’ }
    npm ERR!
    npm ERR! Please try running this command again as root/Administrator.

    npm ERR! A complete log of this run can be found in:
    npm ERR! C:\Users\apps\AppData\Roaming\npm-cache\_logs\2017-11-29T12_59_31_804Z-debug.log

    #544089 Reply

    rdh_rmn
    Participant

    Please find the code (chihu-web-angular.zip) that has been imported from gdrive.
    https://drive.google.com/file/d/1JG904UyAFNeQ19mIVcv1I5IKE0SKDEdj/view?usp=sharing

    #544115 Reply

    support-swapna
    Moderator

    rdh,

    Thank you for the details.

    npm ERR! Please try running this command again as root/Administrator.

    This looks like a problem with NPM as discussed in this thread : https://stackoverflow.com/questions/46105775/npm-install-error-please-try-running-this-command-again-as-root-administrator

    Can you please try ‘npm cache clean’ from command prompt and check if it helps? If you still have trouble with NPM 5.5.x, then please select NPM 4.6.1 in the Import Angular Project wizard and check if the project imports fine.

    Thank you for your patience. Please let us know how it works for you.

    –Swapna
    MyEclipse Support

    #544294 Reply

    rdh_rmn
    Participant

    Hi Swapna,
    I have already tried the same from very 1st day when I saw this message. It does not work for me.
    BTW, for me issue may be entirely different.
    I used to get below error (bash: npm: command not found) when I run any imported project from git. “npm” itself not found. It is environmental kind of issue whihc I am facing with my 1st import project from git in Angular IDE (Webcplise).

    Please suggest what what shoiuld I do to resolve the same.
    <<<—
    ~/git/Angular-cli-starter (master)
    $ npm install
    bash: npm: command not found
    —>>>

    ~/git/Angular-cli-starter (master)
    $

    #544340 Reply

    Brian Fernandes
    Moderator

    rdh,

    Your IDE doesn’t appear to be corrupted, though please use Help > Check for updates to ensure you are on the latest version of Angular IDE.

    I believe you are facing two different issues.

    1) The first is a problem during import, it would appear that you do not have a global/system-wide install of npm and the import process isn’t correcting for this. As a result, when it attempts to run npm commands, it doesn’t find npm installed.

    Do you have a system-wide install of npm? If you go to the command line (outside Angular IDE) and type npm, does it work?

    If you don’t, there may be a bug in our import logic where we don’t install npm in some cases.

    2) You have actually worked around the above issue by setting the npm preference in the CLI tools property page to 5.5.1. Unfortunately, there are several issues with recent versions of npm 5.x on Windows, because of which you are now seeing the EPERM problem (this is a separate, unrelated issue).

    These problems are usually fixed by clearing the npm cache or ensuring that your antivirus is off / Windows defender is not running – this is a problem with npm on Windows, not Angular IDE. If none of those suggestions work, I’d recommend moving down to a 4.x version of npm until the issues with npm 5 on Windows are resolved.

    Do let us know if this helps – in the meanwhile, we’re continuing to investigate both aspects of this problem.

Viewing 15 posts - 1 through 15 (of 15 total)
Reply To: sh: npm command not found