Search code examples
node.jscss-loaderts-loader

facing issues whille installing npm ts loader and npm css loader


I am getting all these warning while installing ts loader and css loader..

npm ts loader

user@user-ThinkPad-T420s:~$ npm install --save-dev ts-loader
npm WARN saveError ENOENT: no such file or directory, open '/home/user/package.json'
/home/user
`-- [email protected] 

npm WARN enoent ENOENT: no such file or directory, open '/home/user/package.json'
npm WARN user No description
npm WARN user No repository field.
npm WARN user No README data
npm WARN user No license field.

npm css loader

user@user-ThinkPad-T420s:~$ npm install --save-dev css-loader
    npm WARN saveError ENOENT: no such file or directory, open '/home/user/package.json'
    /home/user
    `-- [email protected] 

    npm WARN enoent ENOENT: no such file or directory, open '/home/user/package.json'
    npm WARN user No description
    npm WARN user No repository field.
    npm WARN user No README data
    npm WARN user No license field.

can anyone tell me how i can fix this ?


Solution

  • This is happening because you pass --save-dev parameter to npm when you install ts-loader and css-loader modules in a directory with no package.json in it.

    If this is a new project, I suggest you to start by npm init, as it will create you a fresh package.json file for your project.

    You can always install dependency globally if you needed it for more than one project:

    npm install -g ts-loader css-loader
    

    Others alert are not very important, but you can add a licence and a README file to get rid of it if you care.