Search code examples
javascriptnode.jsnpmlerna

Npm scripts always gives an error as "is not recognized as an internal or external command"


I have a lerna repo. There is devDependency to concurrently package from my root package.json. When I type "lerna bootstrap" to command line, it works properly and install all root and subPackages` dependencies to root node_modules folder. But when i type "npm start" it says: 'concurrently' is not recognized as an internal or external command. When i check node_modules/concurrently folder it exists without problem.

My start script is concurrently --kill-others "npm run start-client" "npm run start-server".

This situation same with webpack-dev-server. How can i fix this problem except reinstalling everything.

package.json:

{
    "name": "x-workspace",
    "private": true,
    "workspaces": [
        "packages/*"
    ],
    "devDependencies": {
        "concurrently": "3.5.0",
        "lerna": "^2.11.0"
    },
    "scripts": {
        "start": "concurrently --kill-others \"npm run start-client\" \"npm run start-server\"",
        "build": "webpack --hot",
        "start-client": "npm --prefix ./packages/client-app start",
        "start-server": "cd ./packages/server-app && dotnet run",
        "clean": "rimraf node_modules package-lock.json ./packages/client-app/package-lock.json"
    }
}

Solution

  • I found problem. There is no .bin folder in root node_modules folder. This is result of updating yarn to 1.8.0. When i return back to yarn 1.6.0, it works perfectly.

    Thanks to David R. and other users.