Search code examples
angularjsnode.jsnpmyeomanyeoman-generator-angular

NodeJS - Cannot find module 'spdx-license-ids'


I am new to nodejs, yeoman and having issue(Cannot find module 'spdx-license-ids') while using an angular generator. I have node, bower, grunt installed. Details below.

Error: Cannot find module 'spdx-license-ids'

at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (C:\Users\bdas\AppData\Roaming\npm\node_modules\generator-karma\node_modules\yeoman-generator\node_modules\read-pkg-up\node_modules\read-pkg\node_modules\normalize-package-data\node_modules\validate-npm-package-license\node_modules\spdx-correct\index.js:1:80)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300

enter image description here enter image description here


Solution

  • Not sure about grunt etc, but to simply install any node library, do:

                apt-get install npm 
    

    from the command line, thereafter any node module should be installed with:

                npm install MODULE_NAME
    

    e.g.:

                npm install spdx-license-ids
    

    or to install it globally so node can find it anywhere on your system (not always such a briliiant idea, but anyways), use the global -g flag:

               npm install -g MODULE_NAME 
    

    Those extraneous tools can trip you up sometimes - grunt, yeoman, etc