Thursday, 16 March 2017

Angular2 - Webpack build art error on remote server

Trying to build my Angular2 on the remote server , I get an error that I can't actually understand :

verbose config Skipping project config: /home/sammy/.npmrc. (matches userconfig) verbose stack Error: ENOENT: no such file or directory, open '/home/sammy/package.json'

I don' understand why it's looking for the package.json inside the user's home, and not within the project current directory as stated in the deployment script ? ( should I state a change directory ...)

namespace :client do
  desc 'Build production dist files'
  task :build_aot do
    on roles(:app) do
      client_path = File.join current_path, "client"
      within client_path do
        puts "--> Running build in: '#{client_path}', please wait ..."
        execute "npm run build:prod-aot"
      end
    end
  end
end

which output in the deployment console :

--> Running build in: '/var/www/myproject/current/client', please wait ...
00:18 client:build_aot
      01 npm run build:prod-aot
      01 npm
      01
      01 ERR!

I have the following scripts in /var/www/myproject/current/client/package.json

  "scripts": {
    ....
    "build": "ng build",
    "build:prod": "ng build --target=production --environment=prod",
    "build:prod-aot": "npm run build:prod -- --aot=true",
    ...
   }

thanks for your feedback



via erwin

No comments:

Post a Comment