0

npm install polymer-cli fails in my build definition with the following message

Error: C:\Program Files\nodejs\npm.cmd failed with return code: 1\npm.cmd failed with return code: 1

This worked in the last build and there was no file change.

From the log: 2018-02-06T11:00:52.3800853Z [command]C:\Program Files\nodejs\npm.cmd install -g bower polymer-cli 2018-02-06T11:00:55.2227287Z npm WARN deprecated bower@1.8.2: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/ 2018-02-06T11:01:52.4291618Z C:\NPM\Modules 2018-02-06T11:01:52.4291956Z `-- bower@1.8.2 2018-02-06T11:01:52.4292118Z 2018-02-06T11:01:52.4426138Z npm ERR! Windows_NT 6.3.9600 2018-02-06T11:01:52.4450970Z npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "bower" "polymer-cli" 2018-02-06T11:01:52.4452215Z npm ERR! node v6.9.1 2018-02-06T11:01:52.4454224Z npm ERR! npm v3.10.8 2018-02-06T11:01:52.4454536Z npm ERR! code EBADPLATFORM 2018-02-06T11:01:52.4454739Z 2018-02-06T11:01:52.4455469Z npm ERR! notsup Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) 2018-02-06T11:01:52.4455849Z npm ERR! notsup Valid OS: darwin 2018-02-06T11:01:52.4456122Z npm ERR! notsup Valid Arch: any 2018-02-06T11:01:52.4456414Z npm ERR! notsup Actual OS: win32

Priya
  • 11
  • 3

2 Answers2

2

From the logs, you provided it looks like a cache bug, because of some junk that previously exists and that is causing issues.

Open the command prompt with admin privileges and follow the below steps:

1) Clear the cache: npm cache clean --force. You can also run npm cache verify.

2) Delete node_modules folder using: rm -rf node_modules.

3) Delete any package-lock.json file.

4) Remove the .npm directory.

5) Remove following directories :

   5.1) C:\Users\<username>\AppData\Roaming\npm\. 

   5.2) C:\Users\<username>\AppData\Roaming\npm-cache.

6) Also, Try by setting environment variables:

C:\Users\<username>\AppData\Roaming\npm;C:\Program Files\nodejs.

Type in the command line: which npm.

Maybe you did not set the system value: NODE_PATH it should point to your global module location.

7) Update to the latest npm with npm i -g npm@latest.

8) Also, Update the latest node version.

Hope the above trick resolve your issue.

Suhas Gavad
  • 1,199
  • 1
  • 8
  • 12
  • Thanks, I got this fixed. I had to install the updated version of polymer using install -g polymer-cli@next. That was the problem. – Priya Feb 09 '18 at 15:14
  • Thanks..got this resolved by installing latest trial version of polymer – Priya Feb 26 '18 at 08:53
0

Another solution would be to ignore optional dependencies during the installation: npm install --no-optional polymer-cli -g

Newlukai
  • 549
  • 5
  • 16